Fixed a recursion problem.
Minor editorial changes.
This commit is contained in:
@@ -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,6 +131,7 @@ 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):
|
||||||
|
if self.check_validity:
|
||||||
try:
|
try:
|
||||||
if not valid(entity_descr.valid_until):
|
if not valid(entity_descr.valid_until):
|
||||||
logger.info("Entity descriptor (entity id:%s) to old" % (
|
logger.info("Entity descriptor (entity id:%s) to old" % (
|
||||||
@@ -187,9 +190,11 @@ class MetaData(object):
|
|||||||
logger.error(exc.args[0])
|
logger.error(exc.args[0])
|
||||||
return
|
return
|
||||||
|
|
||||||
|
if self.check_validity:
|
||||||
try:
|
try:
|
||||||
if not valid(self.entities_descr.valid_until):
|
if not valid(self.entities_descr.valid_until):
|
||||||
raise ToOld("Metadata not valid anymore, it's after %s" % (
|
raise ToOld(
|
||||||
|
"Metadata not valid anymore, it's after %s" % (
|
||||||
self.entities_descr.valid_until,))
|
self.entities_descr.valid_until,))
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
pass
|
pass
|
||||||
|
|||||||
@@ -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