Skip to content

Commit cacd7fd

Browse files
author
Dolf Andringa
committed
get_assertion_attribute_value added to Response object. This method can retrieve AssertionAttributes from the assertion tag
1 parent f974cdc commit cacd7fd

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

onelogin/saml/Response.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,13 @@ def _get_name_id(self):
8484
doc="The value requested in the name_identifier_format, e.g., the user's email address",
8585
)
8686

87+
def get_assertion_attribute_value(self,attribute_name):
88+
"""
89+
Get the value of an AssertionAttribute, located in an Assertion/AttributeStatement/Attribute[@Name=attribute_name/AttributeValue tag
90+
"""
91+
result = self._document.xpath('/samlp:Response/saml:Assertion/saml:AttributeStatement/saml:Attribute[@Name="%s"]/saml:AttributeValue'%attribute_name,namespaces=namespaces)
92+
return [n.text.strip() for n in result]
93+
8794
def is_valid(
8895
self,
8996
_clock=None,

0 commit comments

Comments
 (0)