Merge branch 'kerl/bds_authens' into 'master'

Authens pour le BDS

See merge request klub-dev-ens/gestioCOF!441
This commit is contained in:
Ludovic Stephan 2020-08-24 15:38:24 +02:00
commit 1677768177
5 changed files with 61 additions and 51 deletions

View file

@ -13,20 +13,26 @@ 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"
)
STATIC_URL = "/gestion/static/"
MEDIA_ROOT = os.path.join(os.path.dirname(BASE_DIR), "media")
MEDIA_URL = "/gestion/media/"
STATIC_ROOT = "/srv/bds.ens.fr/public/gestion2/static"
STATIC_URL = "/gestion2/static/"
MEDIA_ROOT = "/srv/bds.ens.fr/gestion2/media"
MEDIA_URL = "/gestion2/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"

View file

@ -18,6 +18,11 @@ from .common import (
# COF-specific secrets
# ---
REDIS_PASSWD = import_secret("REDIS_PASSWD")
REDIS_DB = import_secret("REDIS_DB")
REDIS_HOST = import_secret("REDIS_HOST")
REDIS_PORT = import_secret("REDIS_PORT")
RECAPTCHA_PUBLIC_KEY = import_secret("RECAPTCHA_PUBLIC_KEY")
RECAPTCHA_PRIVATE_KEY = import_secret("RECAPTCHA_PRIVATE_KEY")
KFETOPEN_TOKEN = import_secret("KFETOPEN_TOKEN")
@ -112,6 +117,43 @@ AUTHENTICATION_BACKENDS += [
LOGIN_URL = "cof-login"
LOGIN_REDIRECT_URL = "home"
# ---
# Cache settings
# ---
CACHES = {
"default": {
"BACKEND": "redis_cache.RedisCache",
"LOCATION": "redis://:{passwd}@{host}:{port}/{db}".format(
passwd=REDIS_PASSWD, host=REDIS_HOST, port=REDIS_PORT, db=REDIS_DB
),
}
}
# ---
# Channels settings
# ---
CHANNEL_LAYERS = {
"default": {
"BACKEND": "asgi_redis.RedisChannelLayer",
"CONFIG": {
"hosts": [
(
"redis://:{passwd}@{host}:{port}/{db}".format(
passwd=REDIS_PASSWD,
host=REDIS_HOST,
port=REDIS_PORT,
db=REDIS_DB,
)
)
]
},
"ROUTING": "cof.routing.routing",
}
}
# ---
# reCAPTCHA settings

View file

@ -41,11 +41,6 @@ DBNAME = import_secret("DBNAME")
DBUSER = import_secret("DBUSER")
DBPASSWD = import_secret("DBPASSWD")
REDIS_PASSWD = import_secret("REDIS_PASSWD")
REDIS_DB = import_secret("REDIS_DB")
REDIS_HOST = import_secret("REDIS_HOST")
REDIS_PORT = import_secret("REDIS_PORT")
LDAP_SERVER_URL = import_secret("LDAP_SERVER_URL")
@ -146,40 +141,3 @@ CAS_LOGIN_MSG = None
CAS_IGNORE_REFERER = True
CAS_REDIRECT_URL = "/"
CAS_EMAIL_FORMAT = "%s@clipper.ens.fr"
# ---
# Cache settings
# ---
CACHES = {
"default": {
"BACKEND": "redis_cache.RedisCache",
"LOCATION": "redis://:{passwd}@{host}:{port}/{db}".format(
passwd=REDIS_PASSWD, host=REDIS_HOST, port=REDIS_PORT, db=REDIS_DB
),
}
}
# ---
# Channels settings
# ---
CHANNEL_LAYERS = {
"default": {
"BACKEND": "asgi_redis.RedisChannelLayer",
"CONFIG": {
"hosts": [
(
"redis://:{passwd}@{host}:{port}/{db}".format(
passwd=REDIS_PASSWD,
host=REDIS_HOST,
port=REDIS_PORT,
db=REDIS_DB,
)
)
]
},
"ROUTING": "cof.routing.routing",
}
}

View file

@ -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

View file

@ -17,3 +17,4 @@ wagtailmenus==3.*
wagtail-modeltranslation==0.10.*
django-cors-headers==2.2.0
django-js-reverse
authens==0.1b0