227 lines
6.3 KiB
Plaintext
227 lines
6.3 KiB
Plaintext
MandayeJS
|
|
=========
|
|
|
|
|
|
Apache Configuration
|
|
--------------------
|
|
|
|
<VirtualHost _default_:443>
|
|
ServerAdmin webmaster@localhost
|
|
ServerName dev.entrouvert.org.127.0.0.1.xip.io
|
|
DocumentRoot /var/www/
|
|
SSLEngine On
|
|
SSLCertificateFile /etc/ssl/certs/ssl-cert-snakeoil.pem
|
|
SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key
|
|
|
|
CustomLog /var/log/apache2/mandayejs-access.log combined
|
|
ErrorLog /var/log/apache2/mandayejs-error.log
|
|
|
|
SSLProxyEngine on
|
|
ProxyPreserveHost On
|
|
SSLProxyVerify none
|
|
SSLProxyCheckPeerCN off
|
|
SSLProxyCheckPeerName off
|
|
|
|
ProxyPass /_mandaye/ http://localhost:8000/_mandaye/
|
|
ProxyPassReverse /_mandaye/ http://localhost:8000/_mandaye/
|
|
|
|
RequestHeader unset Accept-Encoding
|
|
ProxyPass /_mandaye !
|
|
ProxyPass / https://dev.entrouvert.org/
|
|
ProxyPassReverse / https://dev.entrouvert.org/
|
|
|
|
ExtFilterDefine fixtext mode=output intype=text/html \
|
|
cmd="/bin/sed -e '\$a<script type=\"text/javascript\" src=\"/_mandaye/static/mandaye.js\"></script>'"
|
|
|
|
<Location />
|
|
SetOutputFilter fixtext
|
|
</Location>
|
|
<Location /_mandaye>
|
|
SetOutputFilter None
|
|
</Location>
|
|
|
|
</VirtualHost>
|
|
|
|
Nginx Settings
|
|
--------------
|
|
server {
|
|
listen 443;
|
|
server_name example.com ;
|
|
|
|
ssl on;
|
|
include includes/ssl.conf;
|
|
include includes/example.com.conf;
|
|
|
|
location ~ ^/_mandaye/static/(.+)$ {
|
|
root /;
|
|
try_files /var/lib/mandayejs/tenants/$host/static/$1
|
|
/var/lib/mandayejs/collectstatic/$1
|
|
=404;
|
|
}
|
|
|
|
location /_mandaye/ {
|
|
proxy_pass http://unix:/run/mandayejs/mandayejs.sock;
|
|
proxy_set_header Host $http_host;
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
proxy_set_header X-Forwarded-Host $server_name;
|
|
}
|
|
|
|
location / {
|
|
sub_filter </head> '<script type="text/javascript" src="/_mandaye/static/mandaye.js"></script></head>';
|
|
sub_filter_once off;
|
|
proxy_ssl_server_name on;
|
|
proxy_pass http://example.fr;
|
|
}
|
|
|
|
access_log /var/log/nginx/example.com-access.log combined;
|
|
error_log /var/log/nginx/example.com-errors.log debug;
|
|
}
|
|
|
|
|
|
Settings.json
|
|
-------------
|
|
# Secret Key used for the encryption/decryption
|
|
# Must be 16, 32 or 64 bytes long
|
|
SECRET_KEY = 'whatever you want but keep it secret'
|
|
|
|
# AppSettings module
|
|
SITE_APP = 'mandayejs.applications.Example'
|
|
|
|
# Authentication method for service in a multitenant environment
|
|
HOBO_ANONYMOUS_SERVICE_USER_CLASS = 'hobo.rest_authentication.AnonymousAdminServiceUser'
|
|
|
|
|
|
App Settings
|
|
------------
|
|
# AppSettings are defined in mandayejs/applications.py
|
|
#
|
|
|
|
class Example(AppSettings):
|
|
SITE_LOGIN_PATH = '/'
|
|
SITE_LOCATORS = [
|
|
{
|
|
'id': '#username',
|
|
'label': 'Username',
|
|
'name': 'username',
|
|
'kind': 'string',
|
|
'required': True,
|
|
'help': '',
|
|
},
|
|
{
|
|
'id': '#birth_date',
|
|
'label': 'Birth date',
|
|
'name': 'birth_date',
|
|
'kind': 'date',
|
|
'required': True,
|
|
'help': 'exemple 16/06/2008'
|
|
},
|
|
{
|
|
'id': '#password',
|
|
'label': 'Password',
|
|
'name': 'password',
|
|
'kind': 'password',
|
|
'required': True,
|
|
'help': ''
|
|
},
|
|
]
|
|
|
|
# List of javascript scripts running on every pages
|
|
# they're loaded in panel.html
|
|
SITE_APP_SCRIPTS = [
|
|
'myapp/js/example.com.js',
|
|
]
|
|
|
|
# JS Script asserting authentication through phantomjs
|
|
# The authentication assertion function must be into
|
|
# a var such as :
|
|
#
|
|
# $(function(){
|
|
# window.auth_success = function(){
|
|
# // your code
|
|
# }
|
|
# });
|
|
SITE_AUTH_CHECKER = 'myapp/js/auth.checker.js'
|
|
|
|
# List of cookies to delete when dissociating an account
|
|
SITE_AUTH_COOKIE_KEYS = [
|
|
'UserSessionId',
|
|
]
|
|
|
|
# URL on which the authentication is forced
|
|
# if user is connected and already associated
|
|
SITE_FORCE_REDIRECT_URL = '/login.php'
|
|
|
|
# LOCATOR on which the authentication is forced
|
|
# if user is connected and already associated
|
|
SITE_FORCE_REDIRECT_LOCATOR = '#logon-form'
|
|
|
|
|
|
# Locator used to catch the local application
|
|
# logout process in order to launch a SLO
|
|
SITE_LOGOUT_LOCATOR = '#account_logout'
|
|
|
|
# Application's webservices
|
|
SITE_WEB_SERVICES = {
|
|
'products': '/products/id',
|
|
}
|
|
|
|
# If you class inherits from another and
|
|
# a SITE_LOGIN_PATH need to be set
|
|
SITE_LOGIN_PATH_PREFIX = '/wonderland/'
|
|
|
|
|
|
About Statics
|
|
-------------
|
|
#Panel
|
|
* The logo file must be named *logo.png* and located in tenants/<my_tenant>/static/images/logo.png
|
|
* css related to the panel, must be name *mandaye.css* and located in tenants/<my_tenant>/static/css/mandaye.css
|
|
|
|
#Association
|
|
* 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}
|
|
|
|
|
|
N.B:
|
|
---
|
|
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*
|
|
|
|
|
|
API
|
|
---
|
|
|
|
* GET /_mandaye/api/ :
|
|
response :
|
|
status_code : 200
|
|
data :
|
|
{
|
|
"login": "",
|
|
"password": ""
|
|
}
|
|
|
|
* POST /_mandaye/api :
|
|
data : {
|
|
"name_id_content": "12345",
|
|
"email": "kevin@fake.com",
|
|
"first_name": "kevin",
|
|
"last_name": "fake",
|
|
"locators": {
|
|
"login": "fake",
|
|
"password": "fake"
|
|
}
|
|
}
|
|
|
|
response :
|
|
status_code :
|
|
- success : 200
|
|
- failure : 401/403
|
|
|
|
* DELETE /_mandaye/api :
|
|
data : {
|
|
"name_id_content": "12345"
|
|
}
|
|
response :
|
|
status_code :
|
|
- success : 200
|
|
- failure : 403/404
|
|
|