CAS authentification
This commit is contained in:
parent
9c0b7a66fa
commit
8f6ef82f99
7 changed files with 55 additions and 2 deletions
|
@ -39,6 +39,7 @@ MIDDLEWARE = [
|
||||||
"django.contrib.auth.middleware.AuthenticationMiddleware",
|
"django.contrib.auth.middleware.AuthenticationMiddleware",
|
||||||
"django.contrib.messages.middleware.MessageMiddleware",
|
"django.contrib.messages.middleware.MessageMiddleware",
|
||||||
"django.middleware.clickjacking.XFrameOptionsMiddleware",
|
"django.middleware.clickjacking.XFrameOptionsMiddleware",
|
||||||
|
'django_cas_ng.middleware.CASMiddleware'
|
||||||
]
|
]
|
||||||
|
|
||||||
ROOT_URLCONF = "gestiojeux.urls"
|
ROOT_URLCONF = "gestiojeux.urls"
|
||||||
|
@ -61,6 +62,11 @@ TEMPLATES = [
|
||||||
|
|
||||||
WSGI_APPLICATION = "gestiojeux.wsgi.application"
|
WSGI_APPLICATION = "gestiojeux.wsgi.application"
|
||||||
|
|
||||||
|
AUTHENTICATION_BACKENDS = (
|
||||||
|
'django.contrib.auth.backends.ModelBackend',
|
||||||
|
'django_cas_ng.backends.CASBackend',
|
||||||
|
)
|
||||||
|
|
||||||
# Password validation
|
# Password validation
|
||||||
# https://docs.djangoproject.com/en/3.0/ref/settings/#auth-password-validators
|
# https://docs.djangoproject.com/en/3.0/ref/settings/#auth-password-validators
|
||||||
|
|
||||||
|
@ -78,3 +84,10 @@ AUTH_PASSWORD_VALIDATORS = [
|
||||||
|
|
||||||
STATIC_URL = "/static/"
|
STATIC_URL = "/static/"
|
||||||
MEDIA_URL = "/media/"
|
MEDIA_URL = "/media/"
|
||||||
|
|
||||||
|
CAS_SERVER_URL = "https://cas.eleves.ens.fr/"
|
||||||
|
CAS_VERSION = "2"
|
||||||
|
CAS_LOGIN_MSG = None
|
||||||
|
CAS_IGNORE_REFERER = True
|
||||||
|
CAS_EMAIL_FORMAT = "%s@clipper.ens.fr"
|
||||||
|
|
||||||
|
|
22
gestiojeux_auth/migrations/0001_initial.py
Normal file
22
gestiojeux_auth/migrations/0001_initial.py
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
# Generated by Django 3.1.2 on 2020-10-21 19:57
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
import django.db.models.deletion
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
initial = True
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('auth', '0012_alter_user_first_name_max_length'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='CasUser',
|
||||||
|
fields=[
|
||||||
|
('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, primary_key=True, serialize=False, to='auth.user')),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
]
|
|
@ -30,7 +30,7 @@ def login(req):
|
||||||
"cas_url": reverse("gestiojeux_auth:cas_ng_login"),
|
"cas_url": reverse("gestiojeux_auth:cas_ng_login"),
|
||||||
}
|
}
|
||||||
|
|
||||||
return render(req, "registration/login_switch.html", context=context)
|
return render(req, "login_switch.html", context=context)
|
||||||
|
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
|
|
18
inventory/migrations/0002_auto_20201021_2157.py
Normal file
18
inventory/migrations/0002_auto_20201021_2157.py
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
# Generated by Django 3.1.2 on 2020-10-21 19:57
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('inventory', '0001_initial'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='game',
|
||||||
|
name='image',
|
||||||
|
field=models.ImageField(blank=True, upload_to='game_img/', verbose_name='image'),
|
||||||
|
),
|
||||||
|
]
|
|
@ -1,4 +1,4 @@
|
||||||
{% extends "base_minimal.html" %}
|
{% extends "base.html" %}
|
||||||
|
|
||||||
{% block "content" %}
|
{% block "content" %}
|
||||||
<h1>Accès refusé</h1>
|
<h1>Accès refusé</h1>
|
||||||
|
|
Loading…
Reference in a new issue