Commit 60063db9 authored by Jon Yu's avatar Jon Yu
Browse files

Conditionally add OIDC middleware, extract logout url

parent 07562b3e
Pipeline #17434 passed with stage
in 14 seconds
......@@ -76,8 +76,7 @@ MIDDLEWARE = [
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'mozilla_django_oidc.middleware.SessionRefresh'
'django.middleware.clickjacking.XFrameOptionsMiddleware'
]
ROOT_URLCONF = '{{ project_name }}.urls'
......@@ -110,7 +109,7 @@ AUTHENTICATION_BACKENDS = [
]
LOGIN_REDIRECT_URL = '/'
LOGOUT_REDIRECT_URL = '/'
LOGOUT_REDIRECT_URL = os.getenv('LOGOUT_REDIRECT_URL', '/')
if DEBUG is True:
LOGIN_URL = '/admin'
......@@ -134,6 +133,7 @@ if (OIDC_RP_CLIENT_ID and OIDC_RP_CLIENT_SECRET and OIDC_OP_AUTHORIZATION_ENDPOI
and OIDC_OP_TOKEN_ENDPOINT and OIDC_OP_USER_ENDPOINT):
EXTRA_APPS += ['mozilla_django_oidc']
AUTHENTICATION_BACKENDS += ['oidc_auth.auth.UMichOIDCBackend']
MIDDLEWARE += ['mozilla_django_oidc.middleware.SessionRefresh']
LOGIN_URL = '/oidc/authenticate/'
else:
print('Skipping OIDCAuthenticationBackend as OIDC variables were not set.')
......
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