diff options
Diffstat (limited to 'src/saml2')
-rw-r--r-- | src/saml2/entity.py | 12 | ||||
-rw-r--r-- | src/saml2/mdstore.py | 9 |
2 files changed, 17 insertions, 4 deletions
diff --git a/src/saml2/entity.py b/src/saml2/entity.py index 9f564ffa..fad9326a 100644 --- a/src/saml2/entity.py +++ b/src/saml2/entity.py @@ -53,7 +53,7 @@ from saml2.samlp import ArtifactResponse from saml2.samlp import Artifact from saml2.samlp import LogoutRequest from saml2.samlp import AttributeQuery -from saml2.mdstore import destinations +from saml2.mdstore import destinations, response_destinations from saml2 import BINDING_HTTP_POST from saml2 import BINDING_HTTP_REDIRECT from saml2 import BINDING_SOAP @@ -250,7 +250,7 @@ class Entity(HTTPBase): return info def pick_binding(self, service, bindings=None, descr_type="", request=None, - entity_id=""): + entity_id="", response=False): if request and not entity_id: entity_id = request.issuer.text.strip() @@ -284,7 +284,10 @@ class Entity(HTTPBase): if srv["index"] == _index: return binding, srv["location"] else: - return binding, destinations(srvs)[0] + if response: + return binding, response_destinations(srvs)[0] + else: + return binding, destinations(srvs)[0] except UnsupportedBinding: pass @@ -351,7 +354,8 @@ class Entity(HTTPBase): binding, destination = self.pick_binding(rsrv, bindings, descr_type=descr_type, - request=message) + request=message, + response=True) info["binding"] = binding info["destination"] = destination diff --git a/src/saml2/mdstore.py b/src/saml2/mdstore.py index 24fccb4d..41e521ec 100644 --- a/src/saml2/mdstore.py +++ b/src/saml2/mdstore.py @@ -149,6 +149,15 @@ def metadata_modules(): return _res +def response_destinations(srvs): + _res = [] + for s in srvs: + if "response_location" in s: + _res.append(s["response_location"]) + else: + _res.append(s["location"]) + return _res + def destinations(srvs): return [s["location"] for s in srvs] |