From 46a33741e1f3d3bdeb6d226df1a3510e4e1b5fa9 Mon Sep 17 00:00:00 2001 From: Steve Breker Date: Wed, 25 Sep 2024 09:35:49 -0700 Subject: [PATCH] Remove uppercase logic from oidc_auth Remove automatic conversion of provider names to uppercase from get_oidc_secondary_providers(). --- .../src/settings/components/oidc_auth.py | 28 +++++++++---------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/src/dashboard/src/settings/components/oidc_auth.py b/src/dashboard/src/settings/components/oidc_auth.py index b0d3908b6d..1a15be2359 100644 --- a/src/dashboard/src/settings/components/oidc_auth.py +++ b/src/dashboard/src/settings/components/oidc_auth.py @@ -2,27 +2,25 @@ def get_oidc_secondary_providers(oidc_secondary_provider_names): + """Build secondary OIDC provider details dict. Takes a list of secondary + OIDC providers and gathers details about these providers from env vars. + Output dict contains details for each OIDC connection which can then be + referenced by name. + """ + providers = {} for provider_name in oidc_secondary_provider_names: provider_name = provider_name.strip() - client_id = os.environ.get(f"OIDC_RP_CLIENT_ID_{provider_name.upper()}") - client_secret = os.environ.get(f"OIDC_RP_CLIENT_SECRET_{provider_name.upper()}") + client_id = os.environ.get(f"OIDC_RP_CLIENT_ID_{provider_name}") + client_secret = os.environ.get(f"OIDC_RP_CLIENT_SECRET_{provider_name}") authorization_endpoint = os.environ.get( - f"OIDC_OP_AUTHORIZATION_ENDPOINT_{provider_name.upper()}", "" - ) - token_endpoint = os.environ.get( - f"OIDC_OP_TOKEN_ENDPOINT_{provider_name.upper()}", "" - ) - user_endpoint = os.environ.get( - f"OIDC_OP_USER_ENDPOINT_{provider_name.upper()}", "" - ) - jwks_endpoint = os.environ.get( - f"OIDC_OP_JWKS_ENDPOINT_{provider_name.upper()}", "" - ) - logout_endpoint = os.environ.get( - f"OIDC_OP_LOGOUT_ENDPOINT_{provider_name.upper()}", "" + f"OIDC_OP_AUTHORIZATION_ENDPOINT_{provider_name}", "" ) + token_endpoint = os.environ.get(f"OIDC_OP_TOKEN_ENDPOINT_{provider_name}", "") + user_endpoint = os.environ.get(f"OIDC_OP_USER_ENDPOINT_{provider_name}", "") + jwks_endpoint = os.environ.get(f"OIDC_OP_JWKS_ENDPOINT_{provider_name}", "") + logout_endpoint = os.environ.get(f"OIDC_OP_LOGOUT_ENDPOINT_{provider_name}", "") if client_id and client_secret: providers[provider_name] = {