This repository has been archived on 2023-02-21. You can view files and clone it, but cannot push or open issues or pull requests.
mandayejs/README

227 lines
6.3 KiB
Plaintext
Raw Normal View History

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>
2015-12-04 11:15:44 +01:00
2016-01-12 18:14:22 +01:00
Nginx Settings
--------------
server {
2016-02-02 17:28:02 +01:00
listen 443;
2016-01-12 18:14:22 +01:00
server_name example.com ;
2016-02-02 17:28:02 +01:00
ssl on;
include includes/ssl.conf;
include includes/example.com.conf;
2016-01-12 18:14:22 +01:00
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;
2016-02-02 17:28:02 +01:00
}
2016-01-12 18:14:22 +01:00
location / {
2016-02-02 17:28:02 +01:00
sub_filter </head> '<script type="text/javascript" src="/_mandaye/static/mandaye.js"></script></head>';
2016-01-12 18:14:22 +01:00
sub_filter_once off;
2016-02-02 17:28:02 +01:00
proxy_ssl_server_name on;
2016-01-12 18:14:22 +01:00
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;
}
2015-12-04 11:15:44 +01:00
2016-01-12 18:14:22 +01:00
Settings.json
-------------
2016-01-11 12:58:42 +01:00
# Secret Key used for the encryption/decryption
# Must be 16, 32 or 64 bytes long
SECRET_KEY = 'whatever you want but keep it secret'
2016-02-02 17:28:02 +01:00
# AppSettings module
2016-01-12 18:14:22 +01:00
SITE_APP = 'mandayejs.applications.Example'
2015-12-24 10:48:54 +01:00
2016-02-02 17:28:02 +01:00
# Authentication method for service in a multitenant environment
HOBO_ANONYMOUS_SERVICE_USER_CLASS = 'hobo.rest_authentication.AnonymousAdminServiceUser'
2016-01-12 18:14:22 +01:00
App Settings
------------
# AppSettings are defined in mandayejs/applications.py
2016-02-02 17:28:02 +01:00
#
2016-01-12 18:14:22 +01:00
class Example(AppSettings):
SITE_LOGIN_PATH = '/'
SITE_LOCATORS = [
{
2016-02-02 17:28:02 +01:00
'id': '#username',
2016-01-12 18:14:22 +01:00
'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': ''
},
]
2016-02-02 17:28:02 +01:00
# List of javascript scripts running on every pages
# they're loaded in panel.html
2016-01-12 18:14:22 +01:00
SITE_APP_SCRIPTS = [
'myapp/js/example.com.js',
]
# JS Script asserting authentication through phantomjs
2016-02-02 17:28:02 +01:00
# The authentication assertion function must be into
2016-01-12 18:14:22 +01:00
# a var such as :
#
2016-02-02 17:28:02 +01:00
# $(function(){
2016-01-19 19:21:47 +01:00
# window.auth_success = function(){
2016-02-02 17:28:02 +01:00
# // your code
2016-01-19 19:21:47 +01:00
# }
2016-02-02 17:28:02 +01:00
# });
2016-01-12 18:14:22 +01:00
SITE_AUTH_CHECKER = 'myapp/js/auth.checker.js'
# List of cookies to delete when dissociating an account
2016-01-12 18:14:22 +01:00
SITE_AUTH_COOKIE_KEYS = [
'UserSessionId',
]
2016-02-02 17:28:02 +01:00
# URL on which the authentication is forced
# if user is connected and already associated
SITE_FORCE_REDIRECT_URL = '/login.php'
2016-01-12 18:14:22 +01:00
2016-02-02 17:28:02 +01:00
# LOCATOR on which the authentication is forced
2016-01-19 19:21:47 +01:00
# if user is connected and already associated
SITE_FORCE_REDIRECT_LOCATOR = '#logon-form'
2016-02-09 17:51:27 +01:00
# 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',
}
2016-02-09 17:02:27 +01:00
# If you class inherits from another and
# a SITE_LOGIN_PATH need to be set
SITE_LOGIN_PATH_PREFIX = '/wonderland/'
2016-01-12 18:14:22 +01:00
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
2016-02-12 16:21:49 +01:00
* 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*
2016-01-29 15:50:43 +01:00
API
---
* GET /_mandaye/api/ :
response :
status_code : 200
2016-02-02 17:28:02 +01:00
data :
2016-01-29 15:50:43 +01:00
{
"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"
}
}
2016-02-02 17:28:02 +01:00
response :
status_code :
2016-01-29 15:50:43 +01:00
- success : 200
2016-02-02 17:28:02 +01:00
- failure : 401/403
2016-01-29 15:50:43 +01:00
2016-02-02 17:28:02 +01:00
* DELETE /_mandaye/api :
2016-01-29 15:50:43 +01:00
data : {
"name_id_content": "12345"
}
response :
status_code :
- success : 200
2016-02-02 17:28:02 +01:00
- failure : 403/404