Skip to content

Commit

Permalink
Connecting FLAT to OpenID Connect authentication solution #171 (proyc…
Browse files Browse the repository at this point in the history
  • Loading branch information
proycon committed Feb 17, 2021
1 parent fcfd259 commit 75f3eba
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions roles/languagemachines-python/templates/flat_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,27 @@
DEBUG = True #Set to False for production environments!!!!


##############################################################################
# DJANGO SETTINGS FOR OPENID CONNECT AUTHENTICATION
#############################################################################

{% if oauth_client_id %}
OIDC = True

#note: The redirect url you register with your authorization provider should end in /oidc/callback/

AUTHENTICATION_BACKENDS = ( 'mozilla_django_oidc.auth.OIDCAuthenticationBackend',)

OIDC_RP_CLIENT_ID = "{{ oauth_client_id }}" #As provided by your authorization provider, do not check this into public version control!!!
OIDC_RP_CLIENT_SECRET = "{{ oauth_client_secret }}"#As provider by your authorization provider, Do not check this into public version control!!!

OIDC_OP_AUTHORIZATION_ENDPOINT = "{{ oauth_auth_url }}"
OIDC_OP_TOKEN_ENDPOINT = "{{ oauth_token_url }}"
OIDC_OP_USER_ENDPOINT = "{{ oauth_userinfo_url }}"
{% else %}
OIDC = False
{% endif %}


##############################################################################
# DJANGO SETTINGS THAT NEED NOT BE CHANGED (but you may if you want to, do scroll through at least)
Expand Down Expand Up @@ -453,6 +474,7 @@
# 'django.contrib.admindocs',
'flat.users'
]
if OIDC: INSTALLED_APPS.insert(1, 'mozilla_django_oidc')
for mode,_ in MODES:
INSTALLED_APPS.append('flat.modes.' + mode)
INSTALLED_APPS = tuple(INSTALLED_APPS)
Expand Down

0 comments on commit 75f3eba

Please sign in to comment.