Skip to content

Commit cdd0e9c

Browse files
author
Alexander Schrijver
committed
Make sure to look for Assertion or EncryptedAssertion in the Response specifically. The Advice section can also include Assertions or EncryptedAssertions, and should be ignored.
1 parent 17bacb3 commit cdd0e9c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/onelogin/saml2/response.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -661,8 +661,8 @@ def validate_num_assertions(self):
661661
:returns: True if only 1 assertion encrypted or not
662662
:rtype: bool
663663
"""
664-
encrypted_assertion_nodes = OneLogin_Saml2_XML.query(self.document, '//saml:EncryptedAssertion')
665-
assertion_nodes = OneLogin_Saml2_XML.query(self.document, '//saml:Assertion')
664+
encrypted_assertion_nodes = OneLogin_Saml2_XML.query(self.document, '/samlp:Response/saml:EncryptedAssertion')
665+
assertion_nodes = OneLogin_Saml2_XML.query(self.document, '/samlp:Response/saml:Assertion')
666666

667667
valid = len(encrypted_assertion_nodes) + len(assertion_nodes) == 1
668668

0 commit comments

Comments
 (0)