Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -348,3 +348,4 @@ coverage.xml

# Ignore copied-back autogenerated grpc library
translator/*pb2*.py*
.idea/ruff.xml
17 changes: 8 additions & 9 deletions config/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,12 @@
# Extend middleware to add OIDC auth backend
AUTHENTICATION_BACKENDS += ["scram.route_manager.authentication_backends.ESnetAuthBackend"]

# https://docs.djangoproject.com/en/dev/ref/settings/#login-url
LOGIN_URL = "oidc_authentication_init"

# https://docs.djangoproject.com/en/dev/ref/settings/#logout-url
LOGOUT_URL = "oidc_logout"

# Need to point somewhere otherwise /oidc/logout/ redirects to /oidc/logout/None which 404s
# https://github.com/mozilla/mozilla-django-oidc/issues/118
LOGIN_REDIRECT_URL = "/"
Expand All @@ -327,21 +333,14 @@
# https://github.com/mozilla/mozilla-django-oidc/issues/434
LOGOUT_REDIRECT_URL = "/"

# https://docs.djangoproject.com/en/dev/ref/settings/#login-url
LOGIN_URL = "/"

# https://docs.djangoproject.com/en/dev/ref/settings/#logout-url
LOGOUT_URL = "/"

OIDC_RP_CLIENT_ID = os.environ.get("OIDC_RP_CLIENT_ID")
OIDC_RP_CLIENT_SECRET = os.environ.get("OIDC_RP_CLIENT_SECRET")

elif AUTH_METHOD == "local":
# Points to 'route_manager:home'
# https://docs.djangoproject.com/en/dev/ref/settings/#login-redirect-url
LOGIN_REDIRECT_URL = "local_auth:login"
LOGIN_REDIRECT_URL = "route_manager:home"

LOGOUT_REDIRECT_URL = "local_auth:logout"
LOGOUT_REDIRECT_URL = "route_manager:home"

# https://docs.djangoproject.com/en/dev/ref/settings/#login-url
LOGIN_URL = "local_auth:login"
Expand Down
6 changes: 0 additions & 6 deletions config/settings/local.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,6 @@
msg = "oidc is not yet implemented"
raise NotImplementedError(msg)

# https://docs.djangoproject.com/en/dev/ref/settings/#login-url
LOGIN_URL = "admin:login"
# https://docs.djangoproject.com/en/dev/ref/settings/#logout-url
LOGOUT_URL = "admin:logout"


SCRAM_HOSTNAME = env(
"SCRAM_HOSTNAME",
default="scram_hostname_not_set",
Expand Down
2 changes: 1 addition & 1 deletion requirements/base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ drf-spectacular # https://github.com/tfranzel/drf-spectacular

# OIDC
# ------------------------------------------------------------------------------
mozilla_django_oidc==2.0.0 # https://github.com/mozilla/mozilla-django-oidc
mozilla_django_oidc==4.0.1 # https://github.com/mozilla/mozilla-django-oidc

websockets~=10.3
1 change: 1 addition & 0 deletions scram/route_manager/context_processors.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ def login_logout(request):
"""
login_url = reverse(settings.LOGIN_URL)
logout_url = reverse(settings.LOGOUT_URL)

return {"login": login_url, "logout": logout_url}


Expand Down
Loading