@@ -762,19 +762,28 @@ def _encrypted_assertion(self, xmlstr):
762
762
return self ._assertion (assertion )
763
763
764
764
def parse_assertion (self ):
765
- try :
766
- assert len (self .response .assertion ) == 1 or \
767
- len (self .response .encrypted_assertion ) == 1
768
- except AssertionError :
769
- raise Exception ("No assertion part" )
765
+ if self .context == "AuthnQuery" :
766
+ # can contain one or more assertions
767
+ pass
768
+ else : # This is a saml2int limitation
769
+ try :
770
+ assert len (self .response .assertion ) == 1 or \
771
+ len (self .response .encrypted_assertion ) == 1
772
+ except AssertionError :
773
+ raise Exception ("No assertion part" )
770
774
771
775
if self .response .assertion :
772
776
logger .debug ("***Unencrypted response***" )
773
- return self ._assertion (self .response .assertion [0 ])
777
+ for assertion in self .response .assertion :
778
+ if not self ._assertion (assertion ):
779
+ return False
780
+ return True
774
781
else :
775
782
logger .debug ("***Encrypted response***" )
776
- return self ._encrypted_assertion (
777
- self .response .encrypted_assertion [0 ])
783
+ for assertion in self .response .encrypted_assertion :
784
+ if not self ._encrypted_assertion (assertion ):
785
+ return False
786
+ return True
778
787
779
788
def verify (self ):
780
789
""" Verify that the assertion is syntactically correct and
@@ -883,7 +892,7 @@ def __init__(self, sec_context, attribute_converters, entity_id,
883
892
self .entity_id = entity_id
884
893
self .attribute_converters = attribute_converters
885
894
self .assertion = None
886
- self .context = "AuthnQueryResponse "
895
+ self .context = "AuthnQuery "
887
896
888
897
def condition_ok (self , lax = False ): # Should I care about conditions ?
889
898
return True
0 commit comments