@@ -1198,6 +1198,33 @@ def testIsValidSignWithEmptyReferenceURI(self):
11981198 response = OneLogin_Saml2_Response (settings , xml )
11991199 self .assertTrue (response .is_valid (self .get_request_data ()))
12001200
1201+ def testIsValidWithoutInResponseTo (self ):
1202+ """
1203+ If assertion contains InResponseTo but not the Response tag, we should
1204+ not compare the assertion InResponseTo value to None.
1205+ """
1206+
1207+ # prepare strict settings
1208+ settings_info = self .loadSettingsJSON ()
1209+ settings_info ['strict' ] = True
1210+ settings_info ['idp' ]['entityId' ] = 'https://pitbulk.no-ip.org/simplesaml/saml2/idp/metadata.php'
1211+ settings_info ['sp' ]['entityId' ] = 'https://pitbulk.no-ip.org/newonelogin/demo1/metadata.php'
1212+
1213+ settings = OneLogin_Saml2_Settings (settings_info )
1214+
1215+ xml = self .file_contents (join (self .data_path , 'responses' , 'valid_response_without_inresponseto.xml.base64' ))
1216+ response = OneLogin_Saml2_Response (settings , xml )
1217+
1218+ not_on_or_after = datetime .strptime ('2014-02-19T09:37:01Z' , '%Y-%m-%dT%H:%M:%SZ' )
1219+ not_on_or_after -= timedelta (seconds = 150 )
1220+
1221+ with freeze_time (not_on_or_after ):
1222+ self .assertTrue (response .is_valid ({
1223+ 'https' : 'on' ,
1224+ 'http_host' : 'pitbulk.no-ip.org' ,
1225+ 'script_name' : 'newonelogin/demo1/index.php?acs'
1226+ }))
1227+
12011228
12021229if __name__ == '__main__' :
12031230 if is_running_under_teamcity ():
0 commit comments