Fixed a recursion problem.
Minor editorial changes.
This commit is contained in:
@@ -943,10 +943,10 @@ from mako.lookup import TemplateLookup
|
|||||||
|
|
||||||
AUTHN_BROKER = AuthnBroker()
|
AUTHN_BROKER = AuthnBroker()
|
||||||
AUTHN_BROKER.add(authn_context_class_ref(PASSWORD),
|
AUTHN_BROKER.add(authn_context_class_ref(PASSWORD),
|
||||||
username_password_authn, 10,
|
username_password_authn, 10,
|
||||||
"http://%s" % socket.gethostname())
|
"http://%s" % socket.gethostname())
|
||||||
AUTHN_BROKER.add(authn_context_class_ref(UNSPECIFIED),
|
AUTHN_BROKER.add(authn_context_class_ref(UNSPECIFIED),
|
||||||
"", 0, "http://%s" % socket.gethostname())
|
"", 0, "http://%s" % socket.gethostname())
|
||||||
|
|
||||||
IDP = server.Server(args.config, cache=Cache())
|
IDP = server.Server(args.config, cache=Cache())
|
||||||
IDP.ticket = {}
|
IDP.ticket = {}
|
||||||
|
|||||||
@@ -315,7 +315,6 @@ class Base(Entity):
|
|||||||
protocol_binding=binding,
|
protocol_binding=binding,
|
||||||
scoping=scoping, **args)
|
scoping=scoping, **args)
|
||||||
|
|
||||||
|
|
||||||
def create_attribute_query(self, destination, name_id=None,
|
def create_attribute_query(self, destination, name_id=None,
|
||||||
attribute=None, message_id=0, consent=None,
|
attribute=None, message_id=0, consent=None,
|
||||||
extensions=None, sign=False, sign_prepare=False,
|
extensions=None, sign=False, sign_prepare=False,
|
||||||
|
|||||||
@@ -103,7 +103,8 @@ def repack_cert(cert):
|
|||||||
|
|
||||||
|
|
||||||
class MetaData(object):
|
class MetaData(object):
|
||||||
def __init__(self, onts, attrc, metadata="", node_name=None, **kwargs):
|
def __init__(self, onts, attrc, metadata="", node_name=None,
|
||||||
|
check_validity=True, **kwargs):
|
||||||
self.onts = onts
|
self.onts = onts
|
||||||
self.attrc = attrc
|
self.attrc = attrc
|
||||||
self.entity = {}
|
self.entity = {}
|
||||||
@@ -112,6 +113,7 @@ class MetaData(object):
|
|||||||
self.node_name = node_name
|
self.node_name = node_name
|
||||||
self.entities_descr = None
|
self.entities_descr = None
|
||||||
self.entity_descr = None
|
self.entity_descr = None
|
||||||
|
self.check_validity = check_validity
|
||||||
|
|
||||||
def items(self):
|
def items(self):
|
||||||
return self.entity.items()
|
return self.entity.items()
|
||||||
@@ -129,13 +131,14 @@ class MetaData(object):
|
|||||||
return self.entity[item]
|
return self.entity[item]
|
||||||
|
|
||||||
def do_entity_descriptor(self, entity_descr):
|
def do_entity_descriptor(self, entity_descr):
|
||||||
try:
|
if self.check_validity:
|
||||||
if not valid(entity_descr.valid_until):
|
try:
|
||||||
logger.info("Entity descriptor (entity id:%s) to old" % (
|
if not valid(entity_descr.valid_until):
|
||||||
entity_descr.entity_id,))
|
logger.info("Entity descriptor (entity id:%s) to old" % (
|
||||||
return
|
entity_descr.entity_id,))
|
||||||
except AttributeError:
|
return
|
||||||
pass
|
except AttributeError:
|
||||||
|
pass
|
||||||
|
|
||||||
# have I seen this entity_id before ? If so if log: ignore it
|
# have I seen this entity_id before ? If so if log: ignore it
|
||||||
if entity_descr.entity_id in self.entity:
|
if entity_descr.entity_id in self.entity:
|
||||||
@@ -187,12 +190,14 @@ class MetaData(object):
|
|||||||
logger.error(exc.args[0])
|
logger.error(exc.args[0])
|
||||||
return
|
return
|
||||||
|
|
||||||
try:
|
if self.check_validity:
|
||||||
if not valid(self.entities_descr.valid_until):
|
try:
|
||||||
raise ToOld("Metadata not valid anymore, it's after %s" % (
|
if not valid(self.entities_descr.valid_until):
|
||||||
self.entities_descr.valid_until,))
|
raise ToOld(
|
||||||
except AttributeError:
|
"Metadata not valid anymore, it's after %s" % (
|
||||||
pass
|
self.entities_descr.valid_until,))
|
||||||
|
except AttributeError:
|
||||||
|
pass
|
||||||
|
|
||||||
for entity_descr in self.entities_descr.entity_descriptor:
|
for entity_descr in self.entities_descr.entity_descriptor:
|
||||||
self.do_entity_descriptor(entity_descr)
|
self.do_entity_descriptor(entity_descr)
|
||||||
|
|||||||
@@ -451,8 +451,8 @@ class AuthnResponse(StatusResponse):
|
|||||||
def __init__(self, sec_context, attribute_converters, entity_id,
|
def __init__(self, sec_context, attribute_converters, entity_id,
|
||||||
return_addrs=None, outstanding_queries=None,
|
return_addrs=None, outstanding_queries=None,
|
||||||
timeslack=0, asynchop=True, allow_unsolicited=False,
|
timeslack=0, asynchop=True, allow_unsolicited=False,
|
||||||
test=False, allow_unknown_attributes=False, want_assertions_signed=False,
|
test=False, allow_unknown_attributes=False,
|
||||||
**kwargs):
|
want_assertions_signed=False, **kwargs):
|
||||||
|
|
||||||
StatusResponse.__init__(self, sec_context, return_addrs, timeslack,
|
StatusResponse.__init__(self, sec_context, return_addrs, timeslack,
|
||||||
asynchop=asynchop)
|
asynchop=asynchop)
|
||||||
|
|||||||
@@ -248,6 +248,8 @@ def valid_anytype(val):
|
|||||||
:return: True is value is valid otherwise an exception is raised
|
:return: True is value is valid otherwise an exception is raised
|
||||||
"""
|
"""
|
||||||
for validator in VALIDATOR.values():
|
for validator in VALIDATOR.values():
|
||||||
|
if validator == valid_anytype: # To hinder recursion
|
||||||
|
continue
|
||||||
try:
|
try:
|
||||||
if validator(val):
|
if validator(val):
|
||||||
return True
|
return True
|
||||||
|
|||||||
Reference in New Issue
Block a user