This repository was archived by the owner on Apr 26, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +10
-17
lines changed Expand file tree Collapse file tree 3 files changed +10
-17
lines changed Original file line number Diff line number Diff line change @@ -253,7 +253,8 @@ def _get_endpoint_url(
253
253
rather stick to the host specified on the client configuration.
254
254
"""
255
255
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 ]
257
258
return openid_configuration [field ]
258
259
259
260
def _auth_url (
Original file line number Diff line number Diff line change @@ -119,6 +119,7 @@ def _get_api_requests_mock(
119
119
openid_configuration_route .return_value = Response (
120
120
200 ,
121
121
json = {
122
+ "issuer" : f"{ hostname } { path_prefix } " ,
122
123
"authorization_endpoint" : f"{ hostname } { path_prefix } /authorize" ,
123
124
"token_endpoint" : f"{ hostname } { path_prefix } /token" ,
124
125
"userinfo_endpoint" : f"{ hostname } { path_prefix } /userinfo" ,
@@ -132,7 +133,9 @@ def _get_api_requests_mock(
132
133
json = {"keys" : [signature_key .export (private_key = False , as_dict = True )]},
133
134
)
134
135
136
+ print ("YIELD" )
135
137
yield respx_mock
138
+ print ("RESET" )
136
139
137
140
return _get_api_requests_mock
138
141
Original file line number Diff line number Diff line change @@ -242,24 +242,13 @@ async def test_authorization_url_async(
242
242
assert request .url .host == request .headers ["Host" ]
243
243
244
244
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
246
246
):
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
+ )
259
251
260
- authorize_url = fief_client_tenant .auth_url (
261
- "https://www.bretagne.duchy/callback"
262
- )
263
252
assert (
264
253
authorize_url
265
254
== "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