@@ -84,7 +84,7 @@ class TestSAMLBackend:
8484 @pytest .fixture (autouse = True )
8585 def create_backend (self , sp_conf , idp_conf ):
8686 setup_test_config (sp_conf , idp_conf )
87- self .samlbackend = SAMLBackend (Mock (), INTERNAL_ATTRIBUTES , {"sp_config" : sp_conf ,
87+ self .samlbackend = SAMLBackend (Mock (), Mock (), INTERNAL_ATTRIBUTES , {"sp_config" : sp_conf ,
8888 "disco_srv" : DISCOSRV_URL },
8989 "base_url" ,
9090 "samlbackend" )
@@ -168,7 +168,7 @@ def test_start_auth_redirects_directly_to_mirrored_idp(
168168 def test_redirect_to_idp_if_only_one_idp_in_metadata (self , context , sp_conf , idp_conf ):
169169 sp_conf ["metadata" ]["inline" ] = [create_metadata_from_config_dict (idp_conf )]
170170 # instantiate new backend, without any discovery service configured
171- samlbackend = SAMLBackend (None , INTERNAL_ATTRIBUTES , {"sp_config" : sp_conf }, "base_url" , "saml_backend" )
171+ samlbackend = SAMLBackend (None , None , INTERNAL_ATTRIBUTES , {"sp_config" : sp_conf }, "base_url" , "saml_backend" )
172172
173173 resp = samlbackend .start_auth (context , InternalData ())
174174 assert_redirect_to_idp (resp , idp_conf )
@@ -241,6 +241,7 @@ def test_authn_response_with_encrypted_assertion(self, sp_conf, context):
241241
242242 sp_conf ["entityid" ] = "https://federation-dev-1.scienceforum.sc/Saml2/proxy_saml2_backend.xml"
243243 samlbackend = SAMLBackend (
244+ Mock (),
244245 Mock (),
245246 INTERNAL_ATTRIBUTES ,
246247 {"sp_config" : sp_conf , "disco_srv" : DISCOSRV_URL },
@@ -279,15 +280,15 @@ def test_authn_response_with_encrypted_assertion(self, sp_conf, context):
279280
280281 def test_backend_reads_encryption_key_from_key_file (self , sp_conf ):
281282 sp_conf ["key_file" ] = os .path .join (TEST_RESOURCE_BASE_PATH , "encryption_key.pem" )
282- samlbackend = SAMLBackend (Mock (), INTERNAL_ATTRIBUTES , {"sp_config" : sp_conf ,
283+ samlbackend = SAMLBackend (Mock (), Mock (), INTERNAL_ATTRIBUTES , {"sp_config" : sp_conf ,
283284 "disco_srv" : DISCOSRV_URL },
284285 "base_url" , "samlbackend" )
285286 assert samlbackend .encryption_keys
286287
287288 def test_backend_reads_encryption_key_from_encryption_keypair (self , sp_conf ):
288289 del sp_conf ["key_file" ]
289290 sp_conf ["encryption_keypairs" ] = [{"key_file" : os .path .join (TEST_RESOURCE_BASE_PATH , "encryption_key.pem" )}]
290- samlbackend = SAMLBackend (Mock (), INTERNAL_ATTRIBUTES , {"sp_config" : sp_conf ,
291+ samlbackend = SAMLBackend (Mock (), Mock (), INTERNAL_ATTRIBUTES , {"sp_config" : sp_conf ,
291292 "disco_srv" : DISCOSRV_URL },
292293 "base_url" , "samlbackend" )
293294 assert samlbackend .encryption_keys
@@ -301,7 +302,7 @@ def test_metadata_endpoint(self, context, sp_conf):
301302 def test_get_metadata_desc (self , sp_conf , idp_conf ):
302303 sp_conf ["metadata" ]["inline" ] = [create_metadata_from_config_dict (idp_conf )]
303304 # instantiate new backend, with a single backing IdP
304- samlbackend = SAMLBackend (None , INTERNAL_ATTRIBUTES , {"sp_config" : sp_conf }, "base_url" , "saml_backend" )
305+ samlbackend = SAMLBackend (None , None , INTERNAL_ATTRIBUTES , {"sp_config" : sp_conf }, "base_url" , "saml_backend" )
305306 entity_descriptions = samlbackend .get_metadata_desc ()
306307
307308 assert len (entity_descriptions ) == 1
@@ -328,7 +329,7 @@ def test_get_metadata_desc_with_logo_without_lang(self, sp_conf, idp_conf):
328329
329330 sp_conf ["metadata" ]["inline" ] = [create_metadata_from_config_dict (idp_conf )]
330331 # instantiate new backend, with a single backing IdP
331- samlbackend = SAMLBackend (None , INTERNAL_ATTRIBUTES , {"sp_config" : sp_conf }, "base_url" , "saml_backend" )
332+ samlbackend = SAMLBackend (None , None , INTERNAL_ATTRIBUTES , {"sp_config" : sp_conf }, "base_url" , "saml_backend" )
332333 entity_descriptions = samlbackend .get_metadata_desc ()
333334
334335 assert len (entity_descriptions ) == 1
@@ -356,7 +357,7 @@ def test_default_redirect_to_discovery_service_if_using_mdq(
356357 # one IdP in the metadata, but MDQ also configured so should always redirect to the discovery service
357358 sp_conf ["metadata" ]["inline" ] = [create_metadata_from_config_dict (idp_conf )]
358359 sp_conf ["metadata" ]["mdq" ] = ["https://mdq.example.com" ]
359- samlbackend = SAMLBackend (None , INTERNAL_ATTRIBUTES , {"sp_config" : sp_conf , "disco_srv" : DISCOSRV_URL ,},
360+ samlbackend = SAMLBackend (None , None , INTERNAL_ATTRIBUTES , {"sp_config" : sp_conf , "disco_srv" : DISCOSRV_URL ,},
360361 "base_url" , "saml_backend" )
361362 resp = samlbackend .start_auth (context , InternalData ())
362363 assert_redirect_to_discovery_server (resp , sp_conf , DISCOSRV_URL )
@@ -373,21 +374,21 @@ def test_use_of_disco_or_redirect_to_idp_when_using_mdq_and_forceauthn_is_not_se
373374 SAMLBackend .KEY_MEMORIZE_IDP : True ,
374375 }
375376 samlbackend = SAMLBackend (
376- None , INTERNAL_ATTRIBUTES , backend_conf , "base_url" , "saml_backend"
377+ None , None , INTERNAL_ATTRIBUTES , backend_conf , "base_url" , "saml_backend"
377378 )
378379 resp = samlbackend .start_auth (context , InternalData ())
379380 assert_redirect_to_discovery_server (resp , sp_conf , DISCOSRV_URL )
380381
381382 context .state [Context .KEY_MEMORIZED_IDP ] = idp_conf ["entityid" ]
382383 samlbackend = SAMLBackend (
383- None , INTERNAL_ATTRIBUTES , backend_conf , "base_url" , "saml_backend"
384+ None , None , INTERNAL_ATTRIBUTES , backend_conf , "base_url" , "saml_backend"
384385 )
385386 resp = samlbackend .start_auth (context , InternalData ())
386387 assert_redirect_to_idp (resp , idp_conf )
387388
388389 backend_conf [SAMLBackend .KEY_MEMORIZE_IDP ] = False
389390 samlbackend = SAMLBackend (
390- None , INTERNAL_ATTRIBUTES , backend_conf , "base_url" , "saml_backend"
391+ None , None , INTERNAL_ATTRIBUTES , backend_conf , "base_url" , "saml_backend"
391392 )
392393 resp = samlbackend .start_auth (context , InternalData ())
393394 assert_redirect_to_discovery_server (resp , sp_conf , DISCOSRV_URL )
@@ -396,7 +397,7 @@ def test_use_of_disco_or_redirect_to_idp_when_using_mdq_and_forceauthn_is_not_se
396397 context .state [Context .KEY_MEMORIZED_IDP ] = idp_conf ["entityid" ]
397398 backend_conf [SAMLBackend .KEY_USE_MEMORIZED_IDP_WHEN_FORCE_AUTHN ] = True
398399 samlbackend = SAMLBackend (
399- None , INTERNAL_ATTRIBUTES , backend_conf , "base_url" , "saml_backend"
400+ None , None , INTERNAL_ATTRIBUTES , backend_conf , "base_url" , "saml_backend"
400401 )
401402 resp = samlbackend .start_auth (context , InternalData ())
402403 assert_redirect_to_discovery_server (resp , sp_conf , DISCOSRV_URL )
@@ -417,14 +418,14 @@ def test_use_of_disco_or_redirect_to_idp_when_using_mdq_and_forceauthn_is_set_tr
417418 SAMLBackend .KEY_MIRROR_FORCE_AUTHN : True ,
418419 }
419420 samlbackend = SAMLBackend (
420- None , INTERNAL_ATTRIBUTES , backend_conf , "base_url" , "saml_backend"
421+ None , None , INTERNAL_ATTRIBUTES , backend_conf , "base_url" , "saml_backend"
421422 )
422423 resp = samlbackend .start_auth (context , InternalData ())
423424 assert_redirect_to_discovery_server (resp , sp_conf , DISCOSRV_URL )
424425
425426 backend_conf [SAMLBackend .KEY_USE_MEMORIZED_IDP_WHEN_FORCE_AUTHN ] = True
426427 samlbackend = SAMLBackend (
427- None , INTERNAL_ATTRIBUTES , backend_conf , "base_url" , "saml_backend"
428+ None , None , INTERNAL_ATTRIBUTES , backend_conf , "base_url" , "saml_backend"
428429 )
429430 resp = samlbackend .start_auth (context , InternalData ())
430431 assert_redirect_to_idp (resp , idp_conf )
@@ -445,14 +446,14 @@ def test_use_of_disco_or_redirect_to_idp_when_using_mdq_and_forceauthn_is_set_1(
445446 SAMLBackend .KEY_MIRROR_FORCE_AUTHN : True ,
446447 }
447448 samlbackend = SAMLBackend (
448- None , INTERNAL_ATTRIBUTES , backend_conf , "base_url" , "saml_backend"
449+ None , None , INTERNAL_ATTRIBUTES , backend_conf , "base_url" , "saml_backend"
449450 )
450451 resp = samlbackend .start_auth (context , InternalData ())
451452 assert_redirect_to_discovery_server (resp , sp_conf , DISCOSRV_URL )
452453
453454 backend_conf [SAMLBackend .KEY_USE_MEMORIZED_IDP_WHEN_FORCE_AUTHN ] = True
454455 samlbackend = SAMLBackend (
455- None , INTERNAL_ATTRIBUTES , backend_conf , "base_url" , "saml_backend"
456+ None , None , INTERNAL_ATTRIBUTES , backend_conf , "base_url" , "saml_backend"
456457 )
457458 resp = samlbackend .start_auth (context , InternalData ())
458459 assert_redirect_to_idp (resp , idp_conf )
0 commit comments