Skip to content

Commit c24b47c

Browse files
author
Ioannis Kakavas
committed
Base attribute filtering on internal representation names
Instead on relying on the FriendlyName from metadatata, use the name of the internal representation of an attribute in order to perform filtering. Resolves #422
1 parent 9d0cc9c commit c24b47c

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

src/saml2/assertion.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,10 +79,15 @@ def filter_on_attributes(ava, required=None, optional=None, acs=None,
7979

8080
def _match_attr_name(attr, ava):
8181
try:
82-
friendly_name = attr["friendly_name"]
83-
except KeyError:
84-
friendly_name = get_local_name(acs, attr["name"],
82+
friendly_name = get_local_name(acs, attr["name"],
8583
attr["name_format"])
84+
except:
85+
friendly_name = None
86+
if not friendly_name:
87+
try:
88+
friendly_name = attr["friendly_name"]
89+
except KeyError:
90+
pass
8691

8792
_fn = _match(friendly_name, ava)
8893
if not _fn: # In the unlikely case that someone has provided us with
@@ -91,6 +96,7 @@ def _match_attr_name(attr, ava):
9196

9297
return _fn
9398

99+
94100
def _apply_attr_value_restrictions(attr, res, must=False):
95101
try:
96102
values = [av["text"] for av in attr["attribute_value"]]
@@ -105,7 +111,6 @@ def _apply_attr_value_restrictions(attr, res, must=False):
105111
return _filter_values(ava[_fn], values, must)
106112

107113
res = {}
108-
109114
if required is None:
110115
required = []
111116

0 commit comments

Comments
 (0)