Révision c73a731a
Ajouté par Josué Kouka il y a plus de 8 ans
MANIFEST.in | ||
---|---|---|
2 | 2 |
recursive-include mandayejs/locale *.po *.mo |
3 | 3 |
|
4 | 4 |
# static |
5 |
recursive-include mandayejs/mandaye/static *.css *.js *.ico *.gif *.png *.jpg |
|
5 |
include mandayejs/do_login.js |
|
6 |
recursive-include mandayejs/mandaye *.css *.js *.ico *.gif *.png *.jpg |
|
6 | 7 |
recursive-include mandayejs/sites/vincennes/static *.css *.js *.ico *.gif *.png *.jpg *.ttf *.woff |
7 | 8 |
|
8 | 9 |
# templates |
... | ... | |
11 | 12 |
include COPYING README |
12 | 13 |
include MANIFEST.in |
13 | 14 |
include VERSION |
15 |
|
debian/control | ||
---|---|---|
1 | 1 |
Source: mandayejs |
2 |
Maintainer: Jérôme Schneider <jschneider@entrouvert.com>
|
|
2 |
Maintainer: Josue Kouka <jkouka@entrouvert.org>
|
|
3 | 3 |
Section: python |
4 | 4 |
Priority: optional |
5 | 5 |
Build-Depends: python-setuptools (>= 0.6b3), python-all (>= 2.6.6-3), debhelper (>= 7) |
... | ... | |
12 | 12 |
python-django (>= 1.7), |
13 | 13 |
python-gadjo, |
14 | 14 |
python-django-jsonfield, |
15 |
python-ldap |
|
15 |
python-ldap,
|
|
16 | 16 |
Recommends: python-django-mellon |
17 | 17 |
Description: Authentication Reverse Proxy |
18 | 18 |
|
debian/mandayejs.init | ||
---|---|---|
24 | 24 |
BIND=unix:$RUN_DIR/$NAME.sock |
25 | 25 |
WORKERS=5 |
26 | 26 |
TIMEOUT=30 |
27 |
LOG_LEVEL=debug |
|
27 | 28 |
|
28 | 29 |
MANDAYEJS_SETTINGS_FILE=/usr/lib/$NAME/debian_config.py |
29 | 30 |
MANAGE_SCRIPT="/usr/bin/$NAME-manage" |
... | ... | |
42 | 43 |
--daemon \ |
43 | 44 |
--access-logfile $LOG_DIR/gunicorn-access.log \ |
44 | 45 |
--log-file $LOG_DIR/gunicorn-error.log \ |
46 |
--log-level=$LOG_LEVEL \ |
|
45 | 47 |
--bind=$BIND \ |
46 | 48 |
--workers=$WORKERS \ |
47 | 49 |
--worker-class=sync \ |
debian/settings.py | ||
---|---|---|
54 | 54 |
# CSRF_COOKIE_SECURE = True |
55 | 55 |
# SESSION_COOKIE_SECURE = True |
56 | 56 |
|
57 |
# Site Config |
|
58 |
SITE_DOMAIN = 'example.com' |
|
59 |
SITE_LOGIN_PATH = '/login' |
|
60 |
SITE_HOME_PATH = '/home' # Not required |
|
61 |
SITE_CA_URL = '' # Citizen Account URL |
|
62 |
|
|
63 |
SITE_LOCATORS = [ |
|
64 |
{ |
|
65 |
'id': '', |
|
66 |
'label': '', |
|
67 |
'name': '', |
|
68 |
'kind': 'string', |
|
69 |
'required': True, |
|
70 |
'help': '', |
|
71 |
}, |
|
72 |
{ |
|
73 |
'id': '', |
|
74 |
'label': '', |
|
75 |
'name': '', |
|
76 |
'kind': 'date', |
|
77 |
'required': True, |
|
78 |
'help': 'exemple 16/06/2008' |
|
79 |
}, |
|
80 |
{ |
|
81 |
'id': '', |
|
82 |
'label': '', |
|
83 |
'name': '', |
|
84 |
'kind': 'password', |
|
85 |
'required': True, |
|
86 |
'help': '' |
|
87 |
}, |
|
88 |
] |
|
89 |
|
|
90 |
# list of js scripts runing on every pages |
|
91 |
SITE_SCRIPTS = [ |
|
92 |
'js/example.js', |
|
93 |
] |
|
94 |
|
|
95 |
# js/css script for the association page |
|
96 |
SITE_ASSOCIATE_STATIC = { |
|
97 |
'js': 'js/example_associate.js', |
|
98 |
'css': 'css/example_associate.css' |
|
99 |
} |
|
100 |
|
|
101 |
# Mellon Settings |
|
102 |
MELLON_IDENTITY_PROVIDERS = [ |
|
103 |
{ |
|
104 |
'METADATA_URL': 'https://authentic.example.com.entrouvert.org/idp/saml2/metadata' |
|
105 |
} |
|
106 |
] |
|
107 |
|
|
108 |
MELLON_VERIFY_SSL_CERTIFICATE = False |
do_login.js | ||
---|---|---|
1 |
/* mandayejs - saml reverse proxy |
|
2 |
* Copyright (C) 2015 Entr'ouvert |
|
3 |
* |
|
4 |
* This program is free software: you can redistribute it and/or modify it |
|
5 |
* under the terms of the GNU Affero General Public License as published |
|
6 |
* by the Free Software Foundation, either version 3 of the License, or |
|
7 |
* (at your option) any later version. |
|
8 |
* |
|
9 |
* This program is distributed in the hope that it will be useful, |
|
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 |
* GNU Affero General Public License for more details. |
|
13 |
* |
|
14 |
* You should have received a copy of the GNU Affero General Public License |
|
15 |
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
16 |
*/ |
|
17 |
|
|
18 |
var page = require('webpage').create(); |
|
19 |
var system = require('system'); |
|
20 |
|
|
21 |
var input = JSON.parse(system.stdin.read(2000)); // no .readAll()... |
|
22 |
|
|
23 |
headers_list = [] |
|
24 |
|
|
25 |
page.onResourceReceived = function(response){ |
|
26 |
for (var i=0; i < response.headers.length; i++){ |
|
27 |
var c_header = response.headers[i]; |
|
28 |
if (c_header['name'] === 'Set-Cookie'){ |
|
29 |
headers_list.push(c_header); |
|
30 |
} |
|
31 |
} |
|
32 |
} |
|
33 |
|
|
34 |
page.open(input.address, function() { |
|
35 |
page.onLoadFinished = function() { |
|
36 |
page.render('login.png'); |
|
37 |
console.log(JSON.stringify({'result': 'ok', 'cookies': page.cookies, 'headers': headers_list, 'url': page.frameUrl})); |
|
38 |
phantom.exit(); |
|
39 |
} |
|
40 |
page.injectJs('static/js/jquery.min.js'); |
|
41 |
page.evaluate(function(input) { |
|
42 |
var locators = input.locators; |
|
43 |
for ( var i=0; i < locators.length; i++ ) { |
|
44 |
locator = locators[i]; |
|
45 |
for ( var key in locator ){ |
|
46 |
if (locator.hasOwnProperty(key)){ |
|
47 |
$(key).val(locator[key]); |
|
48 |
} |
|
49 |
} |
|
50 |
} |
|
51 |
$(key).parents('form').find('input[type=submit]').click(); |
|
52 |
}, input); |
|
53 |
}); |
locale/fr/LC_MESSAGES/django.po | ||
---|---|---|
1 |
# SOME DESCRIPTIVE TITLE. |
|
2 |
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER |
|
3 |
# This file is distributed under the same license as the PACKAGE package. |
|
4 |
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. |
|
5 |
# |
|
6 |
#, fuzzy |
|
7 |
msgid "" |
|
8 |
msgstr "" |
|
9 |
"Project-Id-Version: PACKAGE VERSION\n" |
|
10 |
"Report-Msgid-Bugs-To: \n" |
|
11 |
"POT-Creation-Date: 2015-12-14 08:54+0000\n" |
|
12 |
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" |
|
13 |
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" |
|
14 |
"Language-Team: LANGUAGE <LL@li.org>\n" |
|
15 |
"Language: \n" |
|
16 |
"MIME-Version: 1.0\n" |
|
17 |
"Content-Type: text/plain; charset=UTF-8\n" |
|
18 |
"Content-Transfer-Encoding: 8bit\n" |
|
19 |
"Plural-Forms: nplurals=2; plural=(n > 1);\n" |
|
20 |
|
|
21 |
#: mandayejs/mandaye/models.py:24 |
|
22 |
msgid "locators" |
|
23 |
msgstr "selecteurs" |
|
24 |
|
|
25 |
#: mandayejs/mandaye/templates/mandaye/panel.html:10 |
|
26 |
msgid "dissociate" |
|
27 |
msgstr "délier mon compte" |
|
28 |
|
|
29 |
#: mandayejs/mandaye/templates/mandaye/panel.html:12 |
|
30 |
#: mandayejs/mandaye/templates/mandaye/panel.html:16 |
|
31 |
msgid "associate" |
|
32 |
msgstr "lier mon compte" |
|
33 |
|
|
34 |
#: mandayejs/mandaye/views.py:56 |
|
35 |
msgid "login" |
|
36 |
msgstr "se connecter" |
|
37 |
|
|
38 |
#: mandayejs/mandaye/views.py:57 |
|
39 |
msgid "logout" |
|
40 |
msgstr "se déconnecter" |
|
41 |
|
|
42 |
#: mandayejs/mandaye/views.py:99 |
|
43 |
msgid "submit" |
|
44 |
msgstr "valider" |
|
45 |
|
|
46 |
#: mandayejs/mandaye/views.py:100 |
|
47 |
msgid "associate your account" |
|
48 |
msgstr "associer mon compte" |
|
49 |
|
|
50 |
#~ msgid "ca" |
|
51 |
#~ msgstr "compte citoyen" |
mandayejs/do_login.js | ||
---|---|---|
1 |
/* mandayejs - saml reverse proxy |
|
2 |
* Copyright (C) 2015 Entr'ouvert |
|
3 |
* |
|
4 |
* This program is free software: you can redistribute it and/or modify it |
|
5 |
* under the terms of the GNU Affero General Public License as published |
|
6 |
* by the Free Software Foundation, either version 3 of the License, or |
|
7 |
* (at your option) any later version. |
|
8 |
* |
|
9 |
* This program is distributed in the hope that it will be useful, |
|
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 |
* GNU Affero General Public License for more details. |
|
13 |
* |
|
14 |
* You should have received a copy of the GNU Affero General Public License |
|
15 |
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
16 |
*/ |
|
17 |
|
|
18 |
var page = require('webpage').create(); |
|
19 |
var system = require('system'); |
|
20 |
|
|
21 |
var input = JSON.parse(system.stdin.read(2000)); // no .readAll()... |
|
22 |
|
|
23 |
headers_list = [] |
|
24 |
|
|
25 |
page.onResourceReceived = function(response){ |
|
26 |
for (var i=0; i < response.headers.length; i++){ |
|
27 |
var c_header = response.headers[i]; |
|
28 |
if (c_header['name'] === 'Set-Cookie'){ |
|
29 |
headers_list.push(c_header); |
|
30 |
} |
|
31 |
} |
|
32 |
} |
|
33 |
|
|
34 |
page.open(input.address, function() { |
|
35 |
page.onLoadFinished = function() { |
|
36 |
page.render('login.png'); |
|
37 |
console.log(JSON.stringify({'result': 'ok', 'cookies': page.cookies, 'headers': headers_list, 'url': page.frameUrl})); |
|
38 |
phantom.exit(); |
|
39 |
} |
|
40 |
page.injectJs('static/js/jquery.min.js'); |
|
41 |
page.evaluate(function(input) { |
|
42 |
var locators = input.locators; |
|
43 |
for ( var i=0; i < locators.length; i++ ) { |
|
44 |
locator = locators[i]; |
|
45 |
for ( var key in locator ){ |
|
46 |
if (locator.hasOwnProperty(key)){ |
|
47 |
$(key).val(locator[key]); |
|
48 |
} |
|
49 |
} |
|
50 |
} |
|
51 |
$(key).parents('form').find('input[type=submit]').click(); |
|
52 |
}, input); |
|
53 |
}); |
mandayejs/locale/fr/LC_MESSAGES/django.po | ||
---|---|---|
1 |
# SOME DESCRIPTIVE TITLE. |
|
2 |
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER |
|
3 |
# This file is distributed under the same license as the PACKAGE package. |
|
4 |
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. |
|
5 |
# |
|
6 |
#, fuzzy |
|
7 |
msgid "" |
|
8 |
msgstr "" |
|
9 |
"Project-Id-Version: PACKAGE VERSION\n" |
|
10 |
"Report-Msgid-Bugs-To: \n" |
|
11 |
"POT-Creation-Date: 2015-12-17 17:16+0000\n" |
|
12 |
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" |
|
13 |
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" |
|
14 |
"Language-Team: LANGUAGE <LL@li.org>\n" |
|
15 |
"Language: \n" |
|
16 |
"MIME-Version: 1.0\n" |
|
17 |
"Content-Type: text/plain; charset=UTF-8\n" |
|
18 |
"Content-Transfer-Encoding: 8bit\n" |
|
19 |
"Plural-Forms: nplurals=2; plural=(n > 1);\n" |
|
20 |
|
|
21 |
#: mandayejs/mandaye/models.py:24 |
|
22 |
msgid "locators" |
|
23 |
msgstr "selecteurs" |
|
24 |
|
|
25 |
#: mandayejs/mandaye/templates/mandaye/panel.html:10 |
|
26 |
msgid "dissociate" |
|
27 |
msgstr "dissocier mon compte" |
|
28 |
|
|
29 |
#: mandayejs/mandaye/templates/mandaye/panel.html:12 |
|
30 |
#: mandayejs/mandaye/templates/mandaye/panel.html:16 |
|
31 |
msgid "associate" |
|
32 |
msgstr "associer mon compte" |
|
33 |
|
|
34 |
#: mandayejs/mandaye/views.py:56 |
|
35 |
msgid "login" |
|
36 |
msgstr "se connecter" |
|
37 |
|
|
38 |
#: mandayejs/mandaye/views.py:57 |
|
39 |
msgid "logout" |
|
40 |
msgstr "se déconnecter" |
|
41 |
|
|
42 |
#: mandayejs/mandaye/views.py:100 |
|
43 |
msgid "submit" |
|
44 |
msgstr "valider" |
|
45 |
|
|
46 |
#: mandayejs/mandaye/views.py:101 |
|
47 |
msgid "associate your account" |
|
48 |
msgstr "associer mon compte" |
mandayejs/mandaye/templates/mandaye/associate.html | ||
---|---|---|
3 | 3 |
<html> |
4 | 4 |
<head> |
5 | 5 |
<script src="{% xstatic 'jquery' 'jquery.min.js' %}"></script> |
6 |
<link rel="stylesheety" href="{% static associate_static.css %}"/>
|
|
6 |
<link rel="stylesheet" href="{% static associate_static.css %}" type="text/css"/>
|
|
7 | 7 |
<script src="{% static associate_static.js %}" type="text/javascript"></script> |
8 | 8 |
</head> |
9 | 9 |
<body> |
mandayejs/mandaye/views.py | ||
---|---|---|
85 | 85 |
return render(request, 'mandaye/post-login.html', context) |
86 | 86 |
|
87 | 87 |
@login_required |
88 |
@csrf_exempt |
|
88 | 89 |
def associate(request, *args, **kwargs): |
89 | 90 |
if request.POST: |
90 | 91 |
credentials = UserCredentials() |
... | ... | |
94 | 95 |
else: |
95 | 96 |
form = FormFactory(auto_id=True, locators=settings.SITE_LOCATORS) |
96 | 97 |
if not form.is_valid(): |
97 |
User = get_user_model() |
|
98 |
if User.objects.filter(username=request.user.username).exists(): |
|
99 |
return HttpResponseRedirect(resolve_url('post-login')) |
|
100 |
|
|
101 | 98 |
return render(request, 'mandaye/associate.html', { |
102 | 99 |
'form': form, |
103 | 100 |
'submit': _('submit'), |
... | ... | |
143 | 140 |
'--ignore-ssl-errors=yes', |
144 | 141 |
'--ssl-protocol=any', |
145 | 142 |
'--cookies-file=cookies.txt', |
146 |
os.path.join(settings.BASE_DIR,'do_login.js')], |
|
143 |
os.path.join(settings.BASE_DIR,'mandayejs/do_login.js')],
|
|
147 | 144 |
close_fds=True, |
148 | 145 |
stdin=subprocess.PIPE, |
149 | 146 |
stdout=subprocess.PIPE) |
mandayejs/settings.py | ||
---|---|---|
104 | 104 |
) |
105 | 105 |
|
106 | 106 |
LOCALE_PATHS = ( |
107 |
os.path.join(BASE_DIR, 'locale'), |
|
107 |
os.path.join(BASE_DIR, 'mandayejs/locale'),
|
|
108 | 108 |
) |
109 | 109 |
|
110 | 110 |
# Static files (CSS, JavaScript, Images) |
mandayejs/sites/vincennes/static/js/vincennes_associate.js | ||
---|---|---|
1 | 1 |
$(function(){ |
2 |
$('head').append('<link rel="stylesheet" type="text/css" href="/_mandaye/static/css/associate.css">'); |
|
3 | 2 |
$('body').prepend('<a href="https://www.vincennes.fr/"><img id="imgMain" class="img-polaroid" src="/_mandaye/static/images/vincennes-logo-associate.png"></a>'); |
4 | 3 |
}); |
Formats disponibles : Unified diff
debian packaging improved, redirect loop fixed, vincenens js/css updated