Commit 78d6e3a4 authored by Jon Yu's avatar Jon Yu
Browse files

Make OIDC variables optional, remove str_to_bool

parent 8d5b8f26
Pipeline #17883 passed with stage
in 14 seconds
......@@ -17,10 +17,6 @@ from decouple import config
import dj_database_url
def str_to_bool(val):
return val.lower() in ('yes', 'true', 'on', '1')
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
......@@ -119,16 +115,16 @@ LOGOUT_REDIRECT_URL = config('LOGOUT_REDIRECT_URL', '/')
# Mozilla OIDC
# https://mozilla-django-oidc.readthedocs.io/en/stable/
OIDC_RP_CLIENT_ID = config('OIDC_RP_CLIENT_ID')
OIDC_RP_CLIENT_SECRET = config('OIDC_RP_CLIENT_SECRET')
OIDC_OP_AUTHORIZATION_ENDPOINT = config('OIDC_OP_AUTHORIZATION_ENDPOINT')
OIDC_OP_TOKEN_ENDPOINT = config('OIDC_OP_TOKEN_ENDPOINT')
OIDC_OP_USER_ENDPOINT = config('OIDC_OP_USER_ENDPOINT')
OIDC_RP_SIGN_ALGO = config('OIDC_RP_SIGN_ALGO', 'RS256')
OIDC_OP_JWKS_ENDPOINT = config('OIDC_OP_JWKS_ENDPOINT')
OIDC_RP_CLIENT_ID = config('OIDC_RP_CLIENT_ID', default=None)
OIDC_RP_CLIENT_SECRET = config('OIDC_RP_CLIENT_SECRET', default=None)
OIDC_OP_AUTHORIZATION_ENDPOINT = config('OIDC_OP_AUTHORIZATION_ENDPOINT', default=None)
OIDC_OP_TOKEN_ENDPOINT = config('OIDC_OP_TOKEN_ENDPOINT', default=None)
OIDC_OP_USER_ENDPOINT = config('OIDC_OP_USER_ENDPOINT', default=None)
OIDC_RP_SIGN_ALGO = config('OIDC_RP_SIGN_ALGO', default='RS256')
OIDC_OP_JWKS_ENDPOINT = config('OIDC_OP_JWKS_ENDPOINT', default=None)
OIDC_USERNAME_ALGO = 'oidc_auth.auth.generate_username'
OIDC_RP_SCOPES = 'openid email profile'
OIDC_CREATE_USER = str_to_bool(config('OIDC_CREATE_USER', 'on'))
OIDC_CREATE_USER = config('OIDC_CREATE_USER', default=True, cast=bool)
if (OIDC_RP_CLIENT_ID and OIDC_RP_CLIENT_SECRET and OIDC_OP_AUTHORIZATION_ENDPOINT
and OIDC_OP_TOKEN_ENDPOINT and OIDC_OP_USER_ENDPOINT):
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment