From 3d830884b11fb0156b362202f350e0c8e2d8c7f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20P=C3=A9pin?= Date: Thu, 30 Jul 2020 12:04:04 +0200 Subject: [PATCH] Use authens in GestioBDS --- cof/settings/bds_prod.py | 13 +++++++++++-- cof/urls.py | 3 +++ requirements.txt | 1 + 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/cof/settings/bds_prod.py b/cof/settings/bds_prod.py index abd43ca9..6caf3bdf 100644 --- a/cof/settings/bds_prod.py +++ b/cof/settings/bds_prod.py @@ -13,7 +13,7 @@ from .common import BASE_DIR, INSTALLED_APPS ALLOWED_HOSTS = ["bds.ens.fr", "www.bds.ens.fr", "dev.cof.ens.fr"] -INSTALLED_APPS += ["bds", "events", "clubs"] +INSTALLED_APPS += ["bds", "events", "clubs", "authens"] STATIC_ROOT = os.path.join( os.path.dirname(os.path.dirname(BASE_DIR)), "public", "gestion", "static" @@ -28,5 +28,14 @@ MEDIA_URL = "/gestion/media/" # Auth-related stuff # --- -LOGIN_URL = "admin:login" +AUTHENTICATION_BACKENDS = [ + "django.contrib.auth.backends.ModelBackend", + "authens.backends.ENSCASBackend", + "authens.backends.OldCASBackend", +] + +AUTHENS_USE_OLDCAS = False + +LOGIN_URL = "authens:login" LOGIN_REDIRECT_URL = "bds:home" +LOGOUT_REDIRECT_URL = "bds:home" diff --git a/cof/urls.py b/cof/urls.py index fe7bf5d1..af7501d1 100644 --- a/cof/urls.py +++ b/cof/urls.py @@ -144,6 +144,9 @@ if "events" in settings.INSTALLED_APPS: # → rename this when the old events system is out urlpatterns += [path("event_v2/", include("events.urls"))] +if "authens" in settings.INSTALLED_APPS: + urlpatterns.append(path("authens/", include("authens.urls"))) + if "debug_toolbar" in settings.INSTALLED_APPS: import debug_toolbar diff --git a/requirements.txt b/requirements.txt index 9fbc3e06..14c99407 100644 --- a/requirements.txt +++ b/requirements.txt @@ -17,3 +17,4 @@ wagtailmenus==3.* wagtail-modeltranslation==0.10.* django-cors-headers==2.2.0 django-js-reverse +authens==0.*