@@ -68,11 +68,13 @@ def get_status(self):
6868 status = entries [0 ].attrib ['Value' ]
6969 return status
7070
71- def is_valid (self , request_data , request_id = None ):
71+ def is_valid (self , request_data , request_id = None , raise_exceptions = False ):
7272 """
7373 Determines if the SAML LogoutResponse is valid
7474 :param request_id: The ID of the LogoutRequest sent by this SP to the IdP
7575 :type request_id: string
76+ :param raise_exceptions: Whether to return false on failure or raise an exception
77+ :type raise_exceptions: Boolean
7678 :return: Returns if the SAML LogoutResponse is or not valid
7779 :rtype: boolean
7880 """
@@ -89,7 +91,7 @@ def is_valid(self, request_data, request_id=None):
8991 if self .__settings .is_strict ():
9092 res = OneLogin_Saml2_Utils .validate_xml (self .document , 'saml-schema-protocol-2.0.xsd' , self .__settings .is_debug_active ())
9193 if not isinstance (res , Document ):
92- raise Exception ('Invalid SAML Logout Request . Not match the saml-schema-protocol-2.0.xsd' )
94+ raise Exception ('Invalid SAML Logout Response . Not match the saml-schema-protocol-2.0.xsd' )
9395
9496 security = self .__settings .get_security_data ()
9597
@@ -142,6 +144,8 @@ def is_valid(self, request_data, request_id=None):
142144 debug = self .__settings .is_debug_active ()
143145 if debug :
144146 print err .__str__ ()
147+ if raise_exceptions :
148+ raise err
145149 return False
146150
147151 def __query (self , query ):
0 commit comments