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] = {