Skip to content

Commit

Permalink
Added get_in_response_to method to Response and LogoutResponse classes
Browse files Browse the repository at this point in the history
  • Loading branch information
pitbulk committed Jul 2, 2019
1 parent bd86f1e commit fd06de0
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 9 deletions.
21 changes: 14 additions & 7 deletions src/onelogin/saml2/logout_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,14 +101,13 @@ def is_valid(self, request_data, request_id=None, raise_exceptions=False):

security = self.__settings.get_security_data()

in_response_to = self.get_in_response_to()
# Check if the InResponseTo of the Logout Response matches the ID of the Logout Request (requestId) if provided
if request_id is not None and self.document.documentElement.hasAttribute('InResponseTo'):
in_response_to = self.document.documentElement.getAttribute('InResponseTo')
if request_id != in_response_to:
raise OneLogin_Saml2_ValidationError(
'The InResponseTo of the Logout Response: %s, does not match the ID of the Logout request sent by the SP: %s' % (in_response_to, request_id),
OneLogin_Saml2_ValidationError.WRONG_INRESPONSETO
)
if request_id is not None and in_response_to and in_response_to != request_id:
raise OneLogin_Saml2_ValidationError(
'The InResponseTo of the Logout Response: %s, does not match the ID of the Logout request sent by the SP: %s' % (in_response_to, request_id),
OneLogin_Saml2_ValidationError.WRONG_INRESPONSETO
)

# Check issuer
issuer = self.get_issuer()
Expand Down Expand Up @@ -237,6 +236,14 @@ def build(self, in_response_to):

self.__logout_response = logout_response

def get_in_response_to(self):
"""
Gets the ID of the LogoutRequest which this response is in response to
:returns: ID of LogoutRequest this LogoutResponse is in response to or None if it is not present
:rtype: str
"""
return self.document.documentElement.getAttribute('InResponseTo')

def get_response(self, deflate=True):
"""
Returns the Logout Response defated, base64encoded
Expand Down
10 changes: 9 additions & 1 deletion src/onelogin/saml2/response.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ def is_valid(self, request_data, request_id=None, raise_exceptions=False):
security = self.__settings.get_security_data()
current_url = OneLogin_Saml2_Utils.get_self_url_no_query(request_data)

in_response_to = self.document.get('InResponseTo', None)
in_response_to = self.get_in_response_to()
if request_id is None and in_response_to is not None and security.get('rejectUnsolicitedResponsesWithInResponseTo', False):
raise OneLogin_Saml2_ValidationError(
'The Response has an InResponseTo attribute: %s while no InResponseTo was expected' % in_response_to,
Expand Down Expand Up @@ -405,6 +405,14 @@ def get_authn_contexts(self):
authn_context_nodes = self.__query_assertion('/saml:AuthnStatement/saml:AuthnContext/saml:AuthnContextClassRef')
return [OneLogin_Saml2_Utils.element_text(node) for node in authn_context_nodes]

def get_in_response_to(self):
"""
Gets the ID of the request which this response is in response to
:returns: ID of AuthNRequest this Response is in response to or None if it is not present
:rtype: str
"""
return self.document.get('InResponseTo')

def get_issuers(self):
"""
Gets the issuers (from message and from assertion)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
PD94bWwgdmVyc2lvbj0iMS4wIj8+DQo8c2FtbHA6UmVzcG9uc2UgeG1sbnM6c2FtbHA9InVybjpvYXNpczpuYW1lczp0YzpTQU1MOjIuMDpwcm90b2NvbCIgeG1sbnM6c2FtbD0idXJuOm9hc2lzOm5hbWVzOnRjOlNBTUw6Mi4wOmFzc2VydGlvbiIgSUQ9InBmeDhmZWI5YWNkLTFlODYtYWMxMi05MDIzLTEzYjg0NDc5YjI1YiIgVmVyc2lvbj0iMi4wIiBJc3N1ZUluc3RhbnQ9IjIwMTQtMDItMTlUMDE6Mzc6MDFaIiBEZXN0aW5hdGlvbj0iaHR0cHM6Ly9waXRidWxrLm5vLWlwLm9yZy9uZXdvbmVsb2dpbi9kZW1vMS9pbmRleC5waHA/YWNzIiBJblJlc3BvbnNlVG89Ik9ORUxPR0lOXzVmZTlkNmU0OTliMmYwOTEzMjA2YWFiM2Y3MTkxNzI5MDQ5YmI4MDciPjxzYW1sOklzc3Vlcj5odHRwOi8vaWRwLmV4YW1wbGUuY29tLzwvc2FtbDpJc3N1ZXI+PGRzOlNpZ25hdHVyZSB4bWxuczpkcz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC8wOS94bWxkc2lnIyI+DQogIDxkczpT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dHRyaWJ1dGVWYWx1ZT48L3NhbWw6QXR0cmlidXRlPjxzYW1sOkF0dHJpYnV0ZSBOYW1lPSJzbiIgTmFtZUZvcm1hdD0idXJuOm9hc2lzOm5hbWVzOnRjOlNBTUw6Mi4wOmF0dHJuYW1lLWZvcm1hdDpiYXNpYyI+PHNhbWw6QXR0cmlidXRlVmFsdWUgeHNpOnR5cGU9InhzOnN0cmluZyI+TWFydGluMjwvc2FtbDpBdHRyaWJ1dGVWYWx1ZT48L3NhbWw6QXR0cmlidXRlPjxzYW1sOkF0dHJpYnV0ZSBOYW1lPSJlZHVQZXJzb25BZmZpbGlhdGlvbiIgTmFtZUZvcm1hdD0idXJuOm9hc2lzOm5hbWVzOnRjOlNBTUw6Mi4wOmF0dHJuYW1lLWZvcm1hdDpiYXNpYyI+PHNhbWw6QXR0cmlidXRlVmFsdWUgeHNpOnR5cGU9InhzOnN0cmluZyI+dXNlcjwvc2FtbDpBdHRyaWJ1dGVWYWx1ZT48c2FtbDpBdHRyaWJ1dGVWYWx1ZSB4c2k6dHlwZT0ieHM6c3RyaW5nIj5hZG1pbjwvc2FtbDpBdHRyaWJ1dGVWYWx1ZT48L3NhbWw6QXR0cmlidXRlPjwvc2FtbDpBdHRyaWJ1dGVTdGF0ZW1lbnQ+PC9zYW1sOkFzc2VydGlvbj48L3NhbWxwOlJlc3BvbnNlPg==
18 changes: 17 additions & 1 deletion tests/src/OneLogin/saml2_tests/response_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,7 @@ def testGetNameIdData(self):
settings = OneLogin_Saml2_Settings(json_settings)
response_13 = OneLogin_Saml2_Response(settings, xml_6)
nameid_data_13 = response_13.get_nameid_data()
nameid_data_13 = self.assertEqual(expected_nameid_data_5, nameid_data_13)
self.assertEqual(expected_nameid_data_5, nameid_data_13)

json_settings['strict'] = False
json_settings['security']['wantNameId'] = False
Expand Down Expand Up @@ -745,6 +745,22 @@ def testGetSessionNotOnOrAfter(self):
response_3 = OneLogin_Saml2_Response(settings, xml_3)
self.assertEqual(2696012228, response_3.get_session_not_on_or_after())

def testGetInResponseTo(self):
"""
Tests the retrieval of the InResponseTo attribute
"""

settings = OneLogin_Saml2_Settings(self.loadSettingsJSON())

# Response without an InResponseTo element should return None
xml = self.file_contents(join(self.data_path, 'responses', 'response1.xml.base64'))
response = OneLogin_Saml2_Response(settings, xml)
self.assertIsNone(response.get_in_response_to())

xml_3 = self.file_contents(join(self.data_path, 'responses', 'valid_encrypted_assertion.xml.base64'))
response_3 = OneLogin_Saml2_Response(settings, xml_3)
self.assertEqual('ONELOGIN_be60b8caf8e9d19b7a3551b244f116c947ff247d', response_3.get_in_response_to())

def testIsInvalidXML(self):
"""
Tests the is_valid method of the OneLogin_Saml2_Response
Expand Down

0 comments on commit fd06de0

Please sign in to comment.