summaryrefslogtreecommitdiff
path: root/src/saml2/ecp.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/saml2/ecp.py')
-rw-r--r--src/saml2/ecp.py50
1 files changed, 27 insertions, 23 deletions
diff --git a/src/saml2/ecp.py b/src/saml2/ecp.py
index f15a259c..5817cda4 100644
--- a/src/saml2/ecp.py
+++ b/src/saml2/ecp.py
@@ -24,6 +24,8 @@ from saml2.schema import soapenv
from saml2.response import authn_response
+from saml2 import saml
+
logger = logging.getLogger(__name__)
@@ -53,7 +55,7 @@ def ecp_auth_request(cls, entityid=None, relay_state="", sign=False):
# ----------------------------------------
# <paos:Request>
# ----------------------------------------
- my_url = cls.service_url(BINDING_PAOS)
+ my_url = cls.service_urls(BINDING_PAOS)[0]
# must_understand and actor according to the standard
#
@@ -64,6 +66,19 @@ def ecp_auth_request(cls, entityid=None, relay_state="", sign=False):
eelist.append(element_to_extension_element(paos_request))
# ----------------------------------------
+ # <samlp:AuthnRequest>
+ # ----------------------------------------
+
+ logger.info("entityid: %s, binding: %s" % (entityid, BINDING_SOAP))
+
+ location = cls._sso_location(entityid, binding=BINDING_SOAP)
+ req_id, authn_req = cls.create_authn_request(
+ location, binding=BINDING_PAOS, service_url_binding=BINDING_PAOS)
+
+ body = soapenv.Body()
+ body.extension_elements = [element_to_extension_element(authn_req)]
+
+ # ----------------------------------------
# <ecp:Request>
# ----------------------------------------
@@ -74,14 +89,16 @@ def ecp_auth_request(cls, entityid=None, relay_state="", sign=False):
# )
#
# idp_list = samlp.IDPList(idp_entry= [idp])
-#
-# ecp_request = ecp.Request(
-# actor = ACTOR, must_understand = "1",
-# provider_name = "Example Service Provider",
-# issuer=saml.Issuer(text="https://sp.example.org/entity"),
-# idp_list = idp_list)
-#
-# eelist.append(element_to_extension_element(ecp_request))
+
+ idp_list = None
+ ecp_request = ecp.Request(
+ actor=ACTOR,
+ must_understand="1",
+ provider_name=None,
+ issuer=saml.Issuer(text=authn_req.issuer.text),
+ idp_list=idp_list)
+
+ eelist.append(element_to_extension_element(ecp_request))
# ----------------------------------------
# <ecp:RelayState>
@@ -96,19 +113,6 @@ def ecp_auth_request(cls, entityid=None, relay_state="", sign=False):
header.extension_elements = eelist
# ----------------------------------------
- # <samlp:AuthnRequest>
- # ----------------------------------------
-
- logger.info("entityid: %s, binding: %s" % (entityid, BINDING_SOAP))
-
- location = cls._sso_location(entityid, binding=BINDING_SOAP)
- req_id, authn_req = cls.create_authn_request(
- location, binding=BINDING_PAOS, service_url_binding=BINDING_PAOS)
-
- body = soapenv.Body()
- body.extension_elements = [element_to_extension_element(authn_req)]
-
- # ----------------------------------------
# The SOAP envelope
# ----------------------------------------
@@ -126,7 +130,7 @@ def handle_ecp_authn_response(cls, soap_message, outstanding=None):
if item.c_tag == "RelayState" and item.c_namespace == ecp.NAMESPACE:
_relay_state = item
- response = authn_response(cls.config, cls.service_url(), outstanding,
+ response = authn_response(cls.config, cls.service_urls(), outstanding,
allow_unsolicited=True)
response.loads("%s" % rdict["body"], False, soap_message)