summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErwin Junge <erwin@junge.nl>2021-05-05 20:46:05 +0200
committerErwin Junge <erwin@junge.nl>2021-05-05 22:05:09 +0200
commiteb4688163edc9d2b9b01d62ec3984b6c968b6f86 (patch)
tree806045839cbee0fb2f6ce9bf16ba2dba9cda8c5d
parent3bf6199fbde6c47eab79d88b4e3a21106f81c8d0 (diff)
downloadpysaml2-eb4688163edc9d2b9b01d62ec3984b6c968b6f86.tar.gz
Response issuer can be None
-rw-r--r--src/saml2/response.py5
-rw-r--r--tests/test_41_response.py23
2 files changed, 27 insertions, 1 deletions
diff --git a/src/saml2/response.py b/src/saml2/response.py
index 9d4021ee..2b055259 100644
--- a/src/saml2/response.py
+++ b/src/saml2/response.py
@@ -435,7 +435,10 @@ class StatusResponse(object):
self.response = mold.response
def issuer(self):
- return self.response.issuer.text.strip()
+ if self.response.issuer is None:
+ return ""
+ else:
+ return self.response.issuer.text.strip()
class LogoutResponse(StatusResponse):
diff --git a/tests/test_41_response.py b/tests/test_41_response.py
index 9f1dab6b..54f68c47 100644
--- a/tests/test_41_response.py
+++ b/tests/test_41_response.py
@@ -71,6 +71,16 @@ class TestResponse:
name_id=name_id,
authn=AUTHN)
+ self._resp_issuer_none = server.create_authn_response(
+ IDENTITY,
+ "id12", # in_response_to
+ "http://lingon.catalogix.se:8087/",
+ # consumer_url
+ "urn:mace:example.com:saml:roland:sp",
+ # sp_entity_id
+ name_id=name_id)
+ self._resp_issuer_none.issuer = None
+
conf = config.SPConfig()
conf.load_file("server_conf")
self.conf = conf
@@ -99,6 +109,19 @@ class TestResponse:
assert isinstance(resp, StatusResponse)
assert isinstance(resp, AuthnResponse)
+ def test_issuer_none(self):
+ xml_response = ("%s" % (self._resp_issuer_none,))
+ resp = response_factory(xml_response, self.conf,
+ return_addrs=[
+ "http://lingon.catalogix.se:8087/"],
+ outstanding_queries={
+ "id12": "http://localhost:8088/sso"},
+ timeslack=TIMESLACK, decode=False)
+
+ assert isinstance(resp, StatusResponse)
+ assert isinstance(resp, AuthnResponse)
+ assert resp.issuer() == ""
+
@mock.patch('saml2.time_util.datetime')
def test_false_sign(self, mock_datetime):
mock_datetime.utcnow = mock.Mock(