django-modshib-CERTIC 0.2.7__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- django_modshib_certic-0.2.7/LICENSE.txt +81 -0
- django_modshib_certic-0.2.7/PKG-INFO +147 -0
- django_modshib_certic-0.2.7/README.md +127 -0
- django_modshib_certic-0.2.7/modshib/__init__.py +0 -0
- django_modshib_certic-0.2.7/modshib/admin.py +3 -0
- django_modshib_certic-0.2.7/modshib/apps.py +6 -0
- django_modshib_certic-0.2.7/modshib/context_processors.py +22 -0
- django_modshib_certic-0.2.7/modshib/migrations/__init__.py +0 -0
- django_modshib_certic-0.2.7/modshib/models.py +3 -0
- django_modshib_certic-0.2.7/modshib/static/modshib/bootstrap.min.css +7 -0
- django_modshib_certic-0.2.7/modshib/static/modshib/bootstrap.min.css.map +1 -0
- django_modshib_certic-0.2.7/modshib/templates/registration/logged_out.html +17 -0
- django_modshib_certic-0.2.7/modshib/templates/registration/login.html +61 -0
- django_modshib_certic-0.2.7/modshib/templates/registration/reg_base.html +21 -0
- django_modshib_certic-0.2.7/modshib/templates/registration/sso_fail.html +17 -0
- django_modshib_certic-0.2.7/modshib/templates/registration/sso_no_account.html +17 -0
- django_modshib_certic-0.2.7/modshib/tests.py +3 -0
- django_modshib_certic-0.2.7/modshib/urls.py +6 -0
- django_modshib_certic-0.2.7/modshib/views.py +81 -0
- django_modshib_certic-0.2.7/pyproject.toml +27 -0
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
Copyright Université de Caen Normandie
|
|
2
|
+
Esplanade de la paix
|
|
3
|
+
CS 14032
|
|
4
|
+
14032 Caen CEDEX 5
|
|
5
|
+
|
|
6
|
+
Auteur : CERTIC Université de Caen Normandie
|
|
7
|
+
|
|
8
|
+
Contributeurs :
|
|
9
|
+
- Mickaël Desfrênes <mickael.desfrenes@unicaen.fr> 2023
|
|
10
|
+
- Arnaud Daret <arnaud.daret@unicaen.fr> 2023
|
|
11
|
+
|
|
12
|
+
Ce logiciel est un programme informatique servant à faciliter la gestion
|
|
13
|
+
de l'authentification avec le module Apache mod_shib depuis Django.
|
|
14
|
+
|
|
15
|
+
Ce logiciel est régi par la licence CeCILL-C soumise au droit français et
|
|
16
|
+
respectant les principes de diffusion des logiciels libres. Vous pouvez
|
|
17
|
+
utiliser, modifier et/ou redistribuer ce programme sous les conditions
|
|
18
|
+
de la licence CeCILL-C telle que diffusée par le CEA, le CNRS et l'INRIA
|
|
19
|
+
sur le site "http://www.cecill.info".
|
|
20
|
+
|
|
21
|
+
En contrepartie de l'accessibilité au code source et des droits de copie,
|
|
22
|
+
de modification et de redistribution accordés par cette licence, il n'est
|
|
23
|
+
offert aux utilisateurs qu'une garantie limitée. Pour les mêmes raisons,
|
|
24
|
+
seule une responsabilité restreinte pèse sur l'auteur du programme, le
|
|
25
|
+
titulaire des droits patrimoniaux et les concédants successifs.
|
|
26
|
+
|
|
27
|
+
A cet égard l'attention de l'utilisateur est attirée sur les risques
|
|
28
|
+
associés au chargement, à l'utilisation, à la modification et/ou au
|
|
29
|
+
développement et à la reproduction du logiciel par l'utilisateur étant
|
|
30
|
+
donné sa spécificité de logiciel libre, qui peut le rendre complexe à
|
|
31
|
+
manipuler et qui le réserve donc à des développeurs et des professionnels
|
|
32
|
+
avertis possédant des connaissances informatiques approfondies. Les
|
|
33
|
+
utilisateurs sont donc invités à charger et tester l'adéquation du
|
|
34
|
+
logiciel à leurs besoins dans des conditions permettant d'assurer la
|
|
35
|
+
sécurité de leurs systèmes et ou de leurs données et, plus généralement,
|
|
36
|
+
à l'utiliser et l'exploiter dans les mêmes conditions de sécurité.
|
|
37
|
+
|
|
38
|
+
Le fait que vous puissiez accéder à cet en-tête signifie que vous avez
|
|
39
|
+
pris connaissance de la licence CeCILL-C, et que vous en avez accepté les
|
|
40
|
+
termes.
|
|
41
|
+
|
|
42
|
+
=========================================================================
|
|
43
|
+
Copyright Université de Caen Normandie
|
|
44
|
+
Esplanade de la paix
|
|
45
|
+
CS 14032
|
|
46
|
+
14032 Caen CEDEX 5
|
|
47
|
+
|
|
48
|
+
Author: CERTIC Université de Caen Normandie
|
|
49
|
+
|
|
50
|
+
Contributors:
|
|
51
|
+
- Mickaël Desfrênes <mickael.desfrenes@unicaen.fr> 2023
|
|
52
|
+
- Arnaud Daret <arnaud.daret@unicaen.fr> 2023
|
|
53
|
+
|
|
54
|
+
This software is a computer program whose purpose is to facilitate
|
|
55
|
+
authentication with Apache mod_shib from Django.
|
|
56
|
+
|
|
57
|
+
This software is governed by the CeCILL-C license under French law and
|
|
58
|
+
abiding by the rules of distribution of free software. You can use,
|
|
59
|
+
modify and/ or redistribute the software under the terms of the CeCILL-C
|
|
60
|
+
license as circulated by CEA, CNRS and INRIA at the following URL
|
|
61
|
+
"http://www.cecill.info".
|
|
62
|
+
|
|
63
|
+
As a counterpart to the access to the source code and rights to copy,
|
|
64
|
+
modify and redistribute granted by the license, users are provided only
|
|
65
|
+
with a limited warranty and the software's author, the holder of the
|
|
66
|
+
economic rights, and the successive licensors have only limited
|
|
67
|
+
liability.
|
|
68
|
+
|
|
69
|
+
In this respect, the user's attention is drawn to the risks associated
|
|
70
|
+
with loading, using, modifying and/or developing or reproducing the
|
|
71
|
+
software by the user in light of its specific status of free software,
|
|
72
|
+
that may mean that it is complicated to manipulate, and that also
|
|
73
|
+
therefore means that it is reserved for developers and experienced
|
|
74
|
+
professionals having in-depth computer knowledge. Users are therefore
|
|
75
|
+
encouraged to load and test the software's suitability as regards their
|
|
76
|
+
requirements in conditions enabling the security of their systems and/or
|
|
77
|
+
data to be ensured and, more generally, to use and operate it in the
|
|
78
|
+
same conditions as regards security.
|
|
79
|
+
|
|
80
|
+
The fact that you are presently reading this means that you have had
|
|
81
|
+
knowledge of the CeCILL-C license and that you accept its terms.
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: django-modshib-CERTIC
|
|
3
|
+
Version: 0.2.7
|
|
4
|
+
Summary: Faciliter la gestion de l'authentification avec le module Apache mod_shib depuis Django
|
|
5
|
+
Home-page: https://www.certic.unicaen.fr
|
|
6
|
+
License: LICENSE.txt
|
|
7
|
+
Author: Mickaël Desfrênes
|
|
8
|
+
Author-email: mickael.desfrenes@unicaen.fr
|
|
9
|
+
Requires-Python: >=3.9,<4.0
|
|
10
|
+
Classifier: License :: Other/Proprietary License
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
16
|
+
Requires-Dist: Django (>=4.0)
|
|
17
|
+
Requires-Dist: django-auth-cli-certic (>=0.1.3)
|
|
18
|
+
Project-URL: Repository, https://git.unicaen.fr/certic/django-modshib
|
|
19
|
+
Description-Content-Type: text/markdown
|
|
20
|
+
|
|
21
|
+
# Django mod_shib
|
|
22
|
+
|
|
23
|
+
Application Django destinée à faciliter la gestion de l'authentification avec mod_shib.
|
|
24
|
+
Elle fournit une route (URL) devant être gérée par mod_shib, ainsi que des pages prêtes
|
|
25
|
+
à l'emploi pour l'authentification.
|
|
26
|
+
|
|
27
|
+
Distribué sous [Licence CeCILL-C](LICENSE.txt)
|
|
28
|
+
|
|
29
|
+
## Avertissement
|
|
30
|
+
|
|
31
|
+
Pour des raisons de sécurité, ne **jamais** installer cette application en production sans que la configuration du module
|
|
32
|
+
Apache `mod_shib` n'ait été correctement réalisée en amont, particulièrement lorsque
|
|
33
|
+
les variables de configuration `MODSHIB_CREATE_ACCOUNT` et `MODSHIB_ACTIVATE_ACCOUNT`
|
|
34
|
+
valent vrai.
|
|
35
|
+
|
|
36
|
+
## Pré-requis
|
|
37
|
+
|
|
38
|
+
Cette application Django dépend de l'application `django.contrib.auth`. Il est également attendu que la variable
|
|
39
|
+
`LOGIN_REDIRECT_URL` dans votre `settings.py` soit renseignée
|
|
40
|
+
(voir [documentation Django à ce sujet](https://docs.djangoproject.com/fr/4.2/ref/settings/#std-setting-LOGIN_REDIRECT_URL)).
|
|
41
|
+
|
|
42
|
+
Un serveur Apache avec le module Shibboleth est requis. Voir à ce sujet [la documentation spécifique](https://git.unicaen.fr/certic/kics/-/blob/master/doc/INSTALL_shibboleth.md).
|
|
43
|
+
|
|
44
|
+
## installation
|
|
45
|
+
|
|
46
|
+
Installation via pip:
|
|
47
|
+
|
|
48
|
+
pip install django-modshib-certic
|
|
49
|
+
|
|
50
|
+
Ou via poetry:
|
|
51
|
+
|
|
52
|
+
poetry add django-modshib-certic
|
|
53
|
+
|
|
54
|
+
Puis ajouter `modshib.apps.ModshibConfig` dans le `settings.py` de votre projet Django:
|
|
55
|
+
|
|
56
|
+
INSTALLED_APPS = [
|
|
57
|
+
[...]
|
|
58
|
+
"modshib.apps.ModshibConfig",
|
|
59
|
+
]
|
|
60
|
+
|
|
61
|
+
Ainsi que la configuration des routes dans votre `urls.py`:
|
|
62
|
+
|
|
63
|
+
urlpatterns = [
|
|
64
|
+
[...]
|
|
65
|
+
path("modshib/", include("modshib.urls"))
|
|
66
|
+
]
|
|
67
|
+
|
|
68
|
+
L'URL pour modshib sera alors à `/modshib/sso`.
|
|
69
|
+
|
|
70
|
+
Ajoutez également le contexte dans la configuration de vos gabarits :
|
|
71
|
+
|
|
72
|
+
TEMPLATES = [
|
|
73
|
+
{
|
|
74
|
+
[...]
|
|
75
|
+
"OPTIONS": {
|
|
76
|
+
"context_processors": [
|
|
77
|
+
[...]
|
|
78
|
+
"modshib.context_processors.modshib_context"
|
|
79
|
+
],
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
]
|
|
83
|
+
|
|
84
|
+
## Configuration pour `settings.py`
|
|
85
|
+
|
|
86
|
+
### `MODSHIB_CREATE_ACCOUNT`
|
|
87
|
+
|
|
88
|
+
Valeur par défaut : `False`
|
|
89
|
+
|
|
90
|
+
S'il n'existe pas déjà, crée un compte local (modèle `django.contrib.auth.models.User`)
|
|
91
|
+
dont le `username` est l'EPPN fournit par `mod_shib`.
|
|
92
|
+
Le compte est créé sans mot de passe et est inactif par défaut.
|
|
93
|
+
|
|
94
|
+
### `MODSHIB_ACTIVATE_ACCOUNT`
|
|
95
|
+
|
|
96
|
+
Valeur par défaut : `False`
|
|
97
|
+
|
|
98
|
+
Active le compte local s'il est trouvé (`User.is_active=True`).
|
|
99
|
+
|
|
100
|
+
### `MODSHIB_EMAIL_IS_IDENTIFIER`
|
|
101
|
+
|
|
102
|
+
Valeur par défaut : `False`
|
|
103
|
+
|
|
104
|
+
L'email renvoyé par l'IDP est utilisé en remplacement de l'EPPN dans toutes les requêtes impliquant le `username` du
|
|
105
|
+
modèle `django.contrib.auth.models.User`, ce qui inclut le login est la création de compte.
|
|
106
|
+
|
|
107
|
+
### `MODSHIB_FORMS_TITLE`
|
|
108
|
+
|
|
109
|
+
Valeur par défaut: `Authentification`
|
|
110
|
+
|
|
111
|
+
Titre utilisé dans les formulaires de connexion/déconnexion.
|
|
112
|
+
|
|
113
|
+
### `MODSHIB_STYLESHEET_URL`
|
|
114
|
+
|
|
115
|
+
Valeur par défaut: `None`
|
|
116
|
+
|
|
117
|
+
URL utilisée pour ajouter des styles CSS aux pages d'authentification
|
|
118
|
+
|
|
119
|
+
### `MODSHIB_SHOW_SSO_LOGIN`
|
|
120
|
+
|
|
121
|
+
Valeur par défaut: `True`
|
|
122
|
+
|
|
123
|
+
Afficher ou non le formulaire de connexion via SSO
|
|
124
|
+
|
|
125
|
+
### `MODSHIB_SHOW_LOCAL_LOGIN`
|
|
126
|
+
|
|
127
|
+
Valeur par défaut: `True`
|
|
128
|
+
|
|
129
|
+
Afficher ou non le formulaire de connexion locale
|
|
130
|
+
|
|
131
|
+
### `MODSHIB_SSO_SUBMIT_LABEL`
|
|
132
|
+
|
|
133
|
+
Valeur par défaut: `Connexion via SSO`
|
|
134
|
+
|
|
135
|
+
Texte du bouton de connexion via SSO
|
|
136
|
+
|
|
137
|
+
### `MODSHIB_LOCAL_SUBMIT_LABEL`
|
|
138
|
+
|
|
139
|
+
Valeur par défaut: `Connexion avec mot de passe`
|
|
140
|
+
|
|
141
|
+
Texte du bouton de connexion locale
|
|
142
|
+
|
|
143
|
+
### `APP_URL_BASE_PATH`
|
|
144
|
+
|
|
145
|
+
Valeur par défaut: `/`
|
|
146
|
+
|
|
147
|
+
Préfixe utilisé pour déployer l'application
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
# Django mod_shib
|
|
2
|
+
|
|
3
|
+
Application Django destinée à faciliter la gestion de l'authentification avec mod_shib.
|
|
4
|
+
Elle fournit une route (URL) devant être gérée par mod_shib, ainsi que des pages prêtes
|
|
5
|
+
à l'emploi pour l'authentification.
|
|
6
|
+
|
|
7
|
+
Distribué sous [Licence CeCILL-C](LICENSE.txt)
|
|
8
|
+
|
|
9
|
+
## Avertissement
|
|
10
|
+
|
|
11
|
+
Pour des raisons de sécurité, ne **jamais** installer cette application en production sans que la configuration du module
|
|
12
|
+
Apache `mod_shib` n'ait été correctement réalisée en amont, particulièrement lorsque
|
|
13
|
+
les variables de configuration `MODSHIB_CREATE_ACCOUNT` et `MODSHIB_ACTIVATE_ACCOUNT`
|
|
14
|
+
valent vrai.
|
|
15
|
+
|
|
16
|
+
## Pré-requis
|
|
17
|
+
|
|
18
|
+
Cette application Django dépend de l'application `django.contrib.auth`. Il est également attendu que la variable
|
|
19
|
+
`LOGIN_REDIRECT_URL` dans votre `settings.py` soit renseignée
|
|
20
|
+
(voir [documentation Django à ce sujet](https://docs.djangoproject.com/fr/4.2/ref/settings/#std-setting-LOGIN_REDIRECT_URL)).
|
|
21
|
+
|
|
22
|
+
Un serveur Apache avec le module Shibboleth est requis. Voir à ce sujet [la documentation spécifique](https://git.unicaen.fr/certic/kics/-/blob/master/doc/INSTALL_shibboleth.md).
|
|
23
|
+
|
|
24
|
+
## installation
|
|
25
|
+
|
|
26
|
+
Installation via pip:
|
|
27
|
+
|
|
28
|
+
pip install django-modshib-certic
|
|
29
|
+
|
|
30
|
+
Ou via poetry:
|
|
31
|
+
|
|
32
|
+
poetry add django-modshib-certic
|
|
33
|
+
|
|
34
|
+
Puis ajouter `modshib.apps.ModshibConfig` dans le `settings.py` de votre projet Django:
|
|
35
|
+
|
|
36
|
+
INSTALLED_APPS = [
|
|
37
|
+
[...]
|
|
38
|
+
"modshib.apps.ModshibConfig",
|
|
39
|
+
]
|
|
40
|
+
|
|
41
|
+
Ainsi que la configuration des routes dans votre `urls.py`:
|
|
42
|
+
|
|
43
|
+
urlpatterns = [
|
|
44
|
+
[...]
|
|
45
|
+
path("modshib/", include("modshib.urls"))
|
|
46
|
+
]
|
|
47
|
+
|
|
48
|
+
L'URL pour modshib sera alors à `/modshib/sso`.
|
|
49
|
+
|
|
50
|
+
Ajoutez également le contexte dans la configuration de vos gabarits :
|
|
51
|
+
|
|
52
|
+
TEMPLATES = [
|
|
53
|
+
{
|
|
54
|
+
[...]
|
|
55
|
+
"OPTIONS": {
|
|
56
|
+
"context_processors": [
|
|
57
|
+
[...]
|
|
58
|
+
"modshib.context_processors.modshib_context"
|
|
59
|
+
],
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
]
|
|
63
|
+
|
|
64
|
+
## Configuration pour `settings.py`
|
|
65
|
+
|
|
66
|
+
### `MODSHIB_CREATE_ACCOUNT`
|
|
67
|
+
|
|
68
|
+
Valeur par défaut : `False`
|
|
69
|
+
|
|
70
|
+
S'il n'existe pas déjà, crée un compte local (modèle `django.contrib.auth.models.User`)
|
|
71
|
+
dont le `username` est l'EPPN fournit par `mod_shib`.
|
|
72
|
+
Le compte est créé sans mot de passe et est inactif par défaut.
|
|
73
|
+
|
|
74
|
+
### `MODSHIB_ACTIVATE_ACCOUNT`
|
|
75
|
+
|
|
76
|
+
Valeur par défaut : `False`
|
|
77
|
+
|
|
78
|
+
Active le compte local s'il est trouvé (`User.is_active=True`).
|
|
79
|
+
|
|
80
|
+
### `MODSHIB_EMAIL_IS_IDENTIFIER`
|
|
81
|
+
|
|
82
|
+
Valeur par défaut : `False`
|
|
83
|
+
|
|
84
|
+
L'email renvoyé par l'IDP est utilisé en remplacement de l'EPPN dans toutes les requêtes impliquant le `username` du
|
|
85
|
+
modèle `django.contrib.auth.models.User`, ce qui inclut le login est la création de compte.
|
|
86
|
+
|
|
87
|
+
### `MODSHIB_FORMS_TITLE`
|
|
88
|
+
|
|
89
|
+
Valeur par défaut: `Authentification`
|
|
90
|
+
|
|
91
|
+
Titre utilisé dans les formulaires de connexion/déconnexion.
|
|
92
|
+
|
|
93
|
+
### `MODSHIB_STYLESHEET_URL`
|
|
94
|
+
|
|
95
|
+
Valeur par défaut: `None`
|
|
96
|
+
|
|
97
|
+
URL utilisée pour ajouter des styles CSS aux pages d'authentification
|
|
98
|
+
|
|
99
|
+
### `MODSHIB_SHOW_SSO_LOGIN`
|
|
100
|
+
|
|
101
|
+
Valeur par défaut: `True`
|
|
102
|
+
|
|
103
|
+
Afficher ou non le formulaire de connexion via SSO
|
|
104
|
+
|
|
105
|
+
### `MODSHIB_SHOW_LOCAL_LOGIN`
|
|
106
|
+
|
|
107
|
+
Valeur par défaut: `True`
|
|
108
|
+
|
|
109
|
+
Afficher ou non le formulaire de connexion locale
|
|
110
|
+
|
|
111
|
+
### `MODSHIB_SSO_SUBMIT_LABEL`
|
|
112
|
+
|
|
113
|
+
Valeur par défaut: `Connexion via SSO`
|
|
114
|
+
|
|
115
|
+
Texte du bouton de connexion via SSO
|
|
116
|
+
|
|
117
|
+
### `MODSHIB_LOCAL_SUBMIT_LABEL`
|
|
118
|
+
|
|
119
|
+
Valeur par défaut: `Connexion avec mot de passe`
|
|
120
|
+
|
|
121
|
+
Texte du bouton de connexion locale
|
|
122
|
+
|
|
123
|
+
### `APP_URL_BASE_PATH`
|
|
124
|
+
|
|
125
|
+
Valeur par défaut: `/`
|
|
126
|
+
|
|
127
|
+
Préfixe utilisé pour déployer l'application
|
|
File without changes
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
from django.conf import settings
|
|
2
|
+
|
|
3
|
+
_default_conf = {
|
|
4
|
+
"MODSHIB_FORMS_TITLE": "Authentification",
|
|
5
|
+
"MODSHIB_STYLESHEET_URL": None,
|
|
6
|
+
"MODSHIB_SHOW_SSO_LOGIN": True,
|
|
7
|
+
"MODSHIB_SHOW_LOCAL_LOGIN": True,
|
|
8
|
+
"MODSHIB_SSO_SUBMIT_LABEL": "Connexion via SSO",
|
|
9
|
+
"MODSHIB_LOCAL_SUBMIT_LABEL": "Connexion avec mot de passe",
|
|
10
|
+
"APP_URL_BASE_PATH": "/",
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
for k in _default_conf.keys():
|
|
14
|
+
try:
|
|
15
|
+
val = getattr(settings, k)
|
|
16
|
+
_default_conf[k] = val
|
|
17
|
+
except AttributeError:
|
|
18
|
+
continue
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def modshib_context(request):
|
|
22
|
+
return _default_conf
|
|
File without changes
|