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.
Go to file
Agate 4ad3a286cc Prepare Jenkinsfile for Gitea migration (#74572) 2023-02-20 15:11:21 +01:00
debian adapt bits for py3 (#19613) 2020-07-28 13:22:26 +02:00
mandayejs teamnet: update bar and association page styles (#45994) 2020-09-03 12:09:16 +02:00
tests tests: adapt tests to new 401/403 differences: 2020-07-28 14:42:37 +02:00
.gitignore don't ignore .sh files 2020-07-28 13:26:12 +02:00
COPYING add license file 2015-03-22 12:10:03 +01:00
Jenkinsfile Prepare Jenkinsfile for Gitea migration (#74572) 2023-02-20 15:11:21 +01:00
MANIFEST.in misc : update readme and MANIFEST.in 2016-02-09 17:51:27 +01:00
README add default div for logo (#9953) 2016-02-12 17:42:03 +01:00
getlasso.sh setup tests for jenkins' build (#13272) 2016-09-27 18:39:11 +02:00
getlasso3.sh tox: grab lasso for python3 2020-07-28 13:26:24 +02:00
jenkins.sh misc: add ./getlass.sh to jenkins.sh (#13478) 2016-10-05 11:21:11 +02:00
manage.py django-admin startproject mandayejs 2015-03-22 12:09:37 +01:00
pylint.sh jenkins: fix copy/paste error 2016-10-05 11:28:30 +02:00
setup.py setup: allow django 2.2 2020-07-28 16:37:16 +02:00
tox.ini tox: limit mock version for compatibility with python 3.5 2020-10-06 09:24:17 +02:00

README

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