File tree Expand file tree Collapse file tree 3 files changed +5
-7
lines changed
Expand file tree Collapse file tree 3 files changed +5
-7
lines changed Original file line number Diff line number Diff line change @@ -19,10 +19,8 @@ class Settings(BaseSettings):
1919
2020 REGISTER_ENABLE : bool = True
2121 OIDC_DISCOVERY_URL : str = ""
22- OIDC_PROTOCOL : str = "https"
2322 OIDC_CLIENT_ID : str = ""
2423 OIDC_CLIENT_SECRET : str = ""
25- OIDC_HOST : str = ""
2624 OIDC_REDIRECT_URI : str = ""
2725
2826 class Config :
Original file line number Diff line number Diff line change 1616async def auth_params () -> AuthParams :
1717 data = {"oidc" : None , "register_enabled" : settings .REGISTER_ENABLE }
1818
19- if settings .OIDC_HOST and settings . OIDC_CLIENT_ID and settings .OIDC_CLIENT_SECRET :
19+ if settings .OIDC_CLIENT_ID and settings .OIDC_CLIENT_SECRET :
2020 oidc_config = await get_oidc_config ()
2121 auth_endpoint = oidc_config .get ("authorization_endpoint" )
2222 data ["oidc" ] = (
@@ -28,7 +28,7 @@ async def auth_params() -> AuthParams:
2828
2929@router .post ("/oidc/login" , response_model = Token )
3030async def oidc_login (session : SessionDep , code : str = Body (..., embed = True )) -> Token :
31- if not (settings .OIDC_HOST or settings . OIDC_CLIENT_ID or settings .OIDC_CLIENT_SECRET ):
31+ if not (settings .OIDC_CLIENT_ID or settings .OIDC_CLIENT_SECRET ):
3232 raise HTTPException (status_code = 400 , detail = "Partial OIDC config" )
3333
3434 oidc_config = await get_oidc_config ()
Original file line number Diff line number Diff line change @@ -71,9 +71,9 @@ async def get_oidc_config():
7171 if OIDC_CONFIG :
7272 return OIDC_CONFIG
7373
74- discovery_url = f" { settings .OIDC_PROTOCOL } :// { settings . OIDC_HOST } /.well-known/openid-configuration"
75- if settings . OIDC_DISCOVERY_URL :
76- discovery_url = settings . OIDC_DISCOVERY_URL
74+ discovery_url = settings .OIDC_DISCOVERY_URL
75+ if not discovery_url :
76+ raise HTTPException ( status_code = 500 , detail = " OIDC_DISCOVERY_URL not configured" )
7777
7878 OIDC_CONFIG = await httpx_get (discovery_url )
7979 return OIDC_CONFIG
You can’t perform that action at this time.
0 commit comments