Allow for more than one endpoint on a service, possibly with different binding
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from saml2 import BINDING_HTTP_REDIRECT
|
||||
from saml2.config import Config
|
||||
from saml2.metadata import MetaData
|
||||
from py.test import raises
|
||||
@@ -75,6 +76,31 @@ IDP1 = {
|
||||
"xmlsec_binary" : "/usr/local/bin/xmlsec1",
|
||||
}
|
||||
|
||||
IDP2 = {
|
||||
"entityid" : "urn:mace:umu.se:saml:roland:idp",
|
||||
"service": {
|
||||
"idp":{
|
||||
"name" : "Rolands IdP",
|
||||
"endpoints": {
|
||||
"single_sign_on_service" : ["http://localhost:8088/"],
|
||||
"single_logout_service" : [("http://localhost:8088/", BINDING_HTTP_REDIRECT)],
|
||||
},
|
||||
"assertions":{
|
||||
"default": {
|
||||
"attribute_restrictions": {
|
||||
"givenName": None,
|
||||
"surName": None,
|
||||
"eduPersonAffiliation": ["(member|staff)"],
|
||||
"mail": [".*@example.com"],
|
||||
}
|
||||
},
|
||||
"urn:mace:umu.se:saml:roland:sp": None
|
||||
}
|
||||
}
|
||||
},
|
||||
"xmlsec_binary" : "/usr/local/bin/xmlsec1",
|
||||
}
|
||||
|
||||
def _eq(l1,l2):
|
||||
return set(l1) == set(l2)
|
||||
|
||||
@@ -164,7 +190,7 @@ def test_minimum():
|
||||
|
||||
assert c != None
|
||||
|
||||
def test_idp():
|
||||
def test_idp_1():
|
||||
c = Config().load(IDP1)
|
||||
|
||||
print c
|
||||
@@ -173,6 +199,17 @@ def test_idp():
|
||||
|
||||
attribute_restrictions = c.idp_policy().get_attribute_restriction("")
|
||||
assert attribute_restrictions["eduPersonAffiliation"][0].match("staff")
|
||||
|
||||
def test_idp_2():
|
||||
c = Config().load(IDP2)
|
||||
|
||||
print c
|
||||
assert c.services() == ["idp"]
|
||||
assert c.endpoint("idp", "single_logout_service") == [] # default is SOAP
|
||||
assert c.endpoint("idp", "single_logout_service", BINDING_HTTP_REDIRECT) == ['http://localhost:8088/']
|
||||
|
||||
attribute_restrictions = c.idp_policy().get_attribute_restriction("")
|
||||
assert attribute_restrictions["eduPersonAffiliation"][0].match("staff")
|
||||
|
||||
def test_wayf():
|
||||
c = Config().load_file("server.config")
|
||||
|
||||
Reference in New Issue
Block a user