Merge branch 'master' of github.com:rohe/pysaml2
This commit is contained in:
@@ -273,13 +273,8 @@ def post_entity_categories(maps, **kwargs):
|
||||
required = []
|
||||
|
||||
if kwargs["mds"]:
|
||||
try:
|
||||
if "sp_entity_id" in kwargs:
|
||||
ecs = kwargs["mds"].entity_categories(kwargs["sp_entity_id"])
|
||||
except KeyError:
|
||||
for ec_map in maps:
|
||||
for attr in ec_map[""]:
|
||||
restrictions[attr] = None
|
||||
else:
|
||||
for ec_map in maps:
|
||||
for key, (atlist, only_required) in ec_map.items():
|
||||
if key == "": # always released
|
||||
@@ -305,6 +300,10 @@ def post_entity_categories(maps, **kwargs):
|
||||
|
||||
for attr in attrs:
|
||||
restrictions[attr] = None
|
||||
else:
|
||||
for ec_map in maps:
|
||||
for attr in ec_map[""]:
|
||||
restrictions[attr] = None
|
||||
|
||||
return restrictions
|
||||
|
||||
|
@@ -1,4 +1,7 @@
|
||||
from six.moves.urllib.parse import urlencode, parse_qs, urlparse
|
||||
from future.backports.urllib.parse import parse_qs
|
||||
from future.backports.urllib.parse import urlencode
|
||||
from future.backports.urllib.parse import urlparse
|
||||
|
||||
from saml2.entity import Entity
|
||||
from saml2.response import VerificationError
|
||||
|
||||
@@ -9,7 +12,8 @@ IDPDISC_POLICY = "urn:oasis:names:tc:SAML:profiles:SSO:idp-discovery-protocol:si
|
||||
|
||||
class DiscoveryServer(Entity):
|
||||
def __init__(self, config=None, config_file=""):
|
||||
Entity.__init__(self, "disco", config, config_file)
|
||||
if config or config_file:
|
||||
Entity.__init__(self, "disco", config, config_file)
|
||||
|
||||
def parse_discovery_service_request(self, url="", query=""):
|
||||
if url:
|
||||
@@ -22,7 +26,8 @@ class DiscoveryServer(Entity):
|
||||
|
||||
# verify
|
||||
|
||||
for key in ["isPassive", "return", "returnIDParam", "policy"]:
|
||||
for key in ["isPassive", "return", "returnIDParam", "policy",
|
||||
'entityID']:
|
||||
try:
|
||||
assert len(dsr[key]) == 1
|
||||
dsr[key] = dsr[key][0]
|
||||
|
@@ -269,7 +269,7 @@ class MetaData(object):
|
||||
"""
|
||||
Return any entity that matches the specification
|
||||
|
||||
:param typ:
|
||||
:param typ: Type of entity
|
||||
:param service:
|
||||
:param binding:
|
||||
:return:
|
||||
@@ -282,6 +282,37 @@ class MetaData(object):
|
||||
|
||||
return res
|
||||
|
||||
def any2(self, typ, service, binding=None):
|
||||
"""
|
||||
|
||||
:param type:
|
||||
:param service:
|
||||
:param binding:
|
||||
:return:
|
||||
"""
|
||||
res = {}
|
||||
for entid, item in self.items():
|
||||
hit = False
|
||||
try:
|
||||
descr = item['{}sso_descriptor'.format(typ)]
|
||||
except KeyError:
|
||||
continue
|
||||
else:
|
||||
for desc in descr:
|
||||
try:
|
||||
srvs = desc[service]
|
||||
except KeyError:
|
||||
continue
|
||||
else:
|
||||
for srv in srvs:
|
||||
if srv['binding'] == binding:
|
||||
res[entid] = item
|
||||
hit = True
|
||||
break
|
||||
if hit:
|
||||
break
|
||||
return res
|
||||
|
||||
def bindings(self, entity_id, typ, service):
|
||||
"""
|
||||
Get me all the bindings that are registered for a service entity
|
||||
@@ -305,7 +336,7 @@ class MetaData(object):
|
||||
raise NotImplementedError
|
||||
|
||||
def dumps(self):
|
||||
return json.dumps(self.items(), indent=2)
|
||||
return json.dumps(list(self.items()), indent=2)
|
||||
|
||||
def with_descriptor(self, descriptor):
|
||||
'''
|
||||
|
@@ -1,19 +1,11 @@
|
||||
from contextlib import closing
|
||||
from saml2 import saml, sigver
|
||||
from saml2 import md
|
||||
from saml2 import sigver
|
||||
from saml2 import config
|
||||
from saml2.assertion import Policy
|
||||
from saml2.attribute_converter import ac_factory
|
||||
from saml2.extension import mdui
|
||||
from saml2.extension import idpdisc
|
||||
from saml2.extension import dri
|
||||
from saml2.extension import mdattr
|
||||
from saml2.extension import ui
|
||||
from pathutils import full_path
|
||||
from saml2.mdstore import MetadataStore
|
||||
from saml2.server import Server
|
||||
from saml2 import xmldsig
|
||||
from saml2 import xmlenc
|
||||
|
||||
|
||||
ATTRCONV = ac_factory(full_path("attributemaps"))
|
||||
|
@@ -2,20 +2,8 @@
|
||||
|
||||
import argparse
|
||||
|
||||
from saml2 import saml
|
||||
from saml2 import md
|
||||
from saml2 import xmldsig
|
||||
from saml2 import xmlenc
|
||||
|
||||
from saml2.attribute_converter import ac_factory
|
||||
from saml2.httpbase import HTTPBase
|
||||
from saml2.extension import dri
|
||||
from saml2.extension import idpdisc
|
||||
from saml2.extension import mdattr
|
||||
from saml2.extension import mdrpi
|
||||
from saml2.extension import mdui
|
||||
from saml2.extension import shibmd
|
||||
from saml2.extension import ui
|
||||
|
||||
from saml2.sigver import _get_xmlsec_cryptobackend
|
||||
from saml2.sigver import SecurityContext
|
||||
|
Reference in New Issue
Block a user