1
|
MandayeJS
|
2
|
=========
|
3
|
|
4
|
|
5
|
Apache Configuration
|
6
|
--------------------
|
7
|
|
8
|
<VirtualHost _default_:443>
|
9
|
ServerAdmin webmaster@localhost
|
10
|
ServerName dev.entrouvert.org.127.0.0.1.xip.io
|
11
|
DocumentRoot /var/www/
|
12
|
SSLEngine On
|
13
|
SSLCertificateFile /etc/ssl/certs/ssl-cert-snakeoil.pem
|
14
|
SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key
|
15
|
|
16
|
CustomLog /var/log/apache2/mandayejs-access.log combined
|
17
|
ErrorLog /var/log/apache2/mandayejs-error.log
|
18
|
|
19
|
SSLProxyEngine on
|
20
|
ProxyPreserveHost On
|
21
|
SSLProxyVerify none
|
22
|
SSLProxyCheckPeerCN off
|
23
|
SSLProxyCheckPeerName off
|
24
|
|
25
|
ProxyPass /_mandaye/ http://localhost:8000/_mandaye/
|
26
|
ProxyPassReverse /_mandaye/ http://localhost:8000/_mandaye/
|
27
|
|
28
|
RequestHeader unset Accept-Encoding
|
29
|
ProxyPass /_mandaye !
|
30
|
ProxyPass / https://dev.entrouvert.org/
|
31
|
ProxyPassReverse / https://dev.entrouvert.org/
|
32
|
|
33
|
ExtFilterDefine fixtext mode=output intype=text/html \
|
34
|
cmd="/bin/sed -e '\$a<script type=\"text/javascript\" src=\"/_mandaye/static/mandaye.js\"></script>'"
|
35
|
|
36
|
<Location />
|
37
|
SetOutputFilter fixtext
|
38
|
</Location>
|
39
|
<Location /_mandaye>
|
40
|
SetOutputFilter None
|
41
|
</Location>
|
42
|
|
43
|
</VirtualHost>
|
44
|
|
45
|
Nginx Settings
|
46
|
--------------
|
47
|
server {
|
48
|
listen 443;
|
49
|
server_name example.com ;
|
50
|
|
51
|
ssl on;
|
52
|
include includes/ssl.conf;
|
53
|
include includes/example.com.conf;
|
54
|
|
55
|
location ~ ^/_mandaye/static/(.+)$ {
|
56
|
root /;
|
57
|
try_files /var/lib/mandayejs/tenants/$host/static/$1
|
58
|
/var/lib/mandayejs/collectstatic/$1
|
59
|
=404;
|
60
|
}
|
61
|
|
62
|
location /_mandaye/ {
|
63
|
proxy_pass http://unix:/run/mandayejs/mandayejs.sock;
|
64
|
proxy_set_header Host $http_host;
|
65
|
proxy_set_header X-Real-IP $remote_addr;
|
66
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
67
|
proxy_set_header X-Forwarded-Host $server_name;
|
68
|
}
|
69
|
|
70
|
location / {
|
71
|
sub_filter </head> '<script type="text/javascript" src="/_mandaye/static/mandaye.js"></script></head>';
|
72
|
sub_filter_once off;
|
73
|
proxy_ssl_server_name on;
|
74
|
proxy_pass http://example.fr;
|
75
|
}
|
76
|
|
77
|
access_log /var/log/nginx/example.com-access.log combined;
|
78
|
error_log /var/log/nginx/example.com-errors.log debug;
|
79
|
}
|
80
|
|
81
|
|
82
|
Settings.json
|
83
|
-------------
|
84
|
# Secret Key used for the encryption/decryption
|
85
|
# Must be 16, 32 or 64 bytes long
|
86
|
SECRET_KEY = 'whatever you want but keep it secret'
|
87
|
|
88
|
# AppSettings module
|
89
|
SITE_APP = 'mandayejs.applications.Example'
|
90
|
|
91
|
# Authentication method for service in a multitenant environment
|
92
|
HOBO_ANONYMOUS_SERVICE_USER_CLASS = 'hobo.rest_authentication.AnonymousAdminServiceUser'
|
93
|
|
94
|
|
95
|
App Settings
|
96
|
------------
|
97
|
# AppSettings are defined in mandayejs/applications.py
|
98
|
#
|
99
|
|
100
|
class Example(AppSettings):
|
101
|
SITE_LOGIN_PATH = '/'
|
102
|
SITE_LOCATORS = [
|
103
|
{
|
104
|
'id': '#username',
|
105
|
'label': 'Username',
|
106
|
'name': 'username',
|
107
|
'kind': 'string',
|
108
|
'required': True,
|
109
|
'help': '',
|
110
|
},
|
111
|
{
|
112
|
'id': '#birth_date',
|
113
|
'label': 'Birth date',
|
114
|
'name': 'birth_date',
|
115
|
'kind': 'date',
|
116
|
'required': True,
|
117
|
'help': 'exemple 16/06/2008'
|
118
|
},
|
119
|
{
|
120
|
'id': '#password',
|
121
|
'label': 'Password',
|
122
|
'name': 'password',
|
123
|
'kind': 'password',
|
124
|
'required': True,
|
125
|
'help': ''
|
126
|
},
|
127
|
]
|
128
|
|
129
|
# List of javascript scripts running on every pages
|
130
|
# they're loaded in panel.html
|
131
|
SITE_APP_SCRIPTS = [
|
132
|
'myapp/js/example.com.js',
|
133
|
]
|
134
|
|
135
|
# JS Script asserting authentication through phantomjs
|
136
|
# The authentication assertion function must be into
|
137
|
# a var such as :
|
138
|
#
|
139
|
# $(function(){
|
140
|
# window.auth_success = function(){
|
141
|
# // your code
|
142
|
# }
|
143
|
# });
|
144
|
SITE_AUTH_CHECKER = 'myapp/js/auth.checker.js'
|
145
|
|
146
|
# List of cookies to delete when dissociating an account
|
147
|
SITE_AUTH_COOKIE_KEYS = [
|
148
|
'UserSessionId',
|
149
|
]
|
150
|
|
151
|
# URL on which the authentication is forced
|
152
|
# if user is connected and already associated
|
153
|
SITE_FORCE_REDIRECT_URL = '/login.php'
|
154
|
|
155
|
# LOCATOR on which the authentication is forced
|
156
|
# if user is connected and already associated
|
157
|
SITE_FORCE_REDIRECT_LOCATOR = '#logon-form'
|
158
|
|
159
|
|
160
|
# Locator used to catch the local application
|
161
|
# logout process in order to launch a SLO
|
162
|
SITE_LOGOUT_LOCATOR = '#account_logout'
|
163
|
|
164
|
# Application's webservices
|
165
|
SITE_WEB_SERVICES = {
|
166
|
'products': '/products/id',
|
167
|
}
|
168
|
|
169
|
# If you class inherits from another and
|
170
|
# a SITE_LOGIN_PATH need to be set
|
171
|
SITE_LOGIN_PATH_PREFIX = '/wonderland/'
|
172
|
|
173
|
|
174
|
About Statics
|
175
|
-------------
|
176
|
#Panel
|
177
|
* The logo file must be named *logo.png* and located in tenants/<my_tenant>/static/images/logo.png
|
178
|
* css related to the panel, must be name *mandaye.css* and located in tenants/<my_tenant>/static/css/mandaye.css
|
179
|
|
180
|
#Association
|
181
|
* css, js and image (logo) related to the association page must be named respectively *associate.css* and *associate.js* and located in tenants/<my_tenant>/static/{css.js,images}/associate.{css,js,png}
|
182
|
|
183
|
|
184
|
N.B:
|
185
|
---
|
186
|
statics files found in mandayejs/sites/<app_name>/static/<client_name>/<client_app> are there for versioning purpose only. They should placed (if needed) in *tenants/<tenant_name>/static*
|
187
|
|
188
|
|
189
|
API
|
190
|
---
|
191
|
|
192
|
* GET /_mandaye/api/ :
|
193
|
response :
|
194
|
status_code : 200
|
195
|
data :
|
196
|
{
|
197
|
"login": "",
|
198
|
"password": ""
|
199
|
}
|
200
|
|
201
|
* POST /_mandaye/api :
|
202
|
data : {
|
203
|
"name_id_content": "12345",
|
204
|
"email": "kevin@fake.com",
|
205
|
"first_name": "kevin",
|
206
|
"last_name": "fake",
|
207
|
"locators": {
|
208
|
"login": "fake",
|
209
|
"password": "fake"
|
210
|
}
|
211
|
}
|
212
|
|
213
|
response :
|
214
|
status_code :
|
215
|
- success : 200
|
216
|
- failure : 401/403
|
217
|
|
218
|
* DELETE /_mandaye/api :
|
219
|
data : {
|
220
|
"name_id_content": "12345"
|
221
|
}
|
222
|
response :
|
223
|
status_code :
|
224
|
- success : 200
|
225
|
- failure : 403/404
|
226
|
|