This repository was archived by the owner on Apr 26, 2025. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -253,7 +253,8 @@ def _get_endpoint_url(
253253 rather stick to the host specified on the client configuration.
254254 """
255255 if not absolute :
256- return openid_configuration [field ].split (self .base_url )[1 ]
256+ issuer = openid_configuration ["issuer" ]
257+ return openid_configuration [field ].split (issuer )[1 ]
257258 return openid_configuration [field ]
258259
259260 def _auth_url (
Original file line number Diff line number Diff line change @@ -119,6 +119,7 @@ def _get_api_requests_mock(
119119 openid_configuration_route .return_value = Response (
120120 200 ,
121121 json = {
122+ "issuer" : f"{ hostname } { path_prefix } " ,
122123 "authorization_endpoint" : f"{ hostname } { path_prefix } /authorize" ,
123124 "token_endpoint" : f"{ hostname } { path_prefix } /token" ,
124125 "userinfo_endpoint" : f"{ hostname } { path_prefix } /userinfo" ,
@@ -132,7 +133,9 @@ def _get_api_requests_mock(
132133 json = {"keys" : [signature_key .export (private_key = False , as_dict = True )]},
133134 )
134135
136+ print ("YIELD" )
135137 yield respx_mock
138+ print ("RESET" )
136139
137140 return _get_api_requests_mock
138141
Original file line number Diff line number Diff line change @@ -242,24 +242,13 @@ async def test_authorization_url_async(
242242 assert request .url .host == request .headers ["Host" ]
243243
244244 def test_authorization_url_tenant (
245- self , fief_client_tenant : Fief , mock_api_requests : respx . MockRouter
245+ self , fief_client_tenant : Fief , get_api_requests_mock : GetAPIRequestsMock
246246 ):
247- openid_configuration_route = mock_api_requests .get (
248- "/secondary/.well-known/openid-configuration"
249- )
250- openid_configuration_route .return_value = Response (
251- 200 ,
252- json = {
253- "authorization_endpoint" : "https://bretagne.fief.dev/secondary/authorize" ,
254- "token_endpoint" : "https://bretagne.fief.dev/secondary/token" ,
255- "userinfo_endpoint" : "https://bretagne.fief.dev/secondary/userinfo" ,
256- "jwks_uri" : "https://bretagne.fief.dev/secondary/.well-known/jwks.json" ,
257- },
258- )
247+ with get_api_requests_mock (path_prefix = "/secondary" ):
248+ authorize_url = fief_client_tenant .auth_url (
249+ "https://www.bretagne.duchy/callback"
250+ )
259251
260- authorize_url = fief_client_tenant .auth_url (
261- "https://www.bretagne.duchy/callback"
262- )
263252 assert (
264253 authorize_url
265254 == "https://bretagne.fief.dev/secondary/authorize?response_type=code&client_id=CLIENT_ID&redirect_uri=https%3A%2F%2Fwww.bretagne.duchy%2Fcallback"
You can’t perform that action at this time.
0 commit comments