summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard van der Hoff <richard@matrix.org>2020-08-10 19:23:40 +0100
committerRichard van der Hoff <richard@matrix.org>2020-08-10 19:23:40 +0100
commitd05a7fff90f84c27e1e8f3f8c2269e36bab5f2bc (patch)
tree1056506102f4dc108478f55a85799180b02ab457
parentf8aca945103ce587f9082c6cfa9b18ab73a3daf1 (diff)
downloadpysaml2-d05a7fff90f84c27e1e8f3f8c2269e36bab5f2bc.tar.gz
Fix automatic inversion of attribute map files
In order for automatic inversion of attribute maps to work, we need to accept definitions of attribute maps with only one of `to` or `fro`.
-rw-r--r--src/saml2/attribute_converter.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/saml2/attribute_converter.py b/src/saml2/attribute_converter.py
index 43c345ff..306dbfde 100644
--- a/src/saml2/attribute_converter.py
+++ b/src/saml2/attribute_converter.py
@@ -98,7 +98,9 @@ def _find_maps_in_module(module):
for key, item in module.__dict__.items():
if key.startswith("__"):
continue
- if isinstance(item, dict) and "to" in item and "fro" in item:
+ if isinstance(item, dict) and "identifier" in item and (
+ "to" in item or "fro" in item
+ ):
yield item