| 1 |
REST session backend |
| 2 |
==================== |
| 3 |
|
| 4 |
Session <type> can be 'global' for SSO sessions or 'persistent' for |
| 5 |
persistent sessions. |
| 6 |
|
| 7 |
LL::NG Portal provides REST end points for sessions management: |
| 8 |
|
| 9 |
- GET /sessions/<type>/<session-id> : get session data |
| 10 |
- GET /sessions/<type>/<session-id>/<key> : get a session key value |
| 11 |
- GET /sessions/<type>/<session-id>/[k1,k2] : get some keys value |
| 12 |
- POST /sessions/<type> : create a session |
| 13 |
- PUT /sessions/<type>/<session-id> : update some keys |
| 14 |
- DELETE /sessions/<type>/<session-id> : delete a session |
| 15 |
|
| 16 |
Sessions for connected users (used by :doc:`LLNG Proxy<authproxy>`): |
| 17 |
|
| 18 |
- GET /session/my/<type> : get session data |
| 19 |
- GET /session/my/<type>/key : get session key |
| 20 |
- DELETE /session/my : ask for logout |
| 21 |
- DELETE /sessions/my : ask for global logout (if GlobalLogout plugin is on) |
| 22 |
|
| 23 |
Services for connected users (always enabled): |
| 24 |
|
| 25 |
- GET /mysession/?authorizationfor=<base64-encoded-url> : ask if an url |
| 26 |
is authorized |
| 27 |
- GET /mysession/?whoami : get "my" uid |
| 28 |
- PUT /mysession/<type> : update some persistent data (restricted) |
| 29 |
- DELETE /mysession/<type>/key : delete key in data (restricted) |
| 30 |
- GET /myapplications : get "my" appplications list |
| 31 |
|
| 32 |
This session backend can be used to share sessions stored in a |
| 33 |
non-network backend (like |
| 34 |
:doc:`file session backend<filesessionbackend>`) or in a network backend |
| 35 |
protected with a firewall that only accepts HTTP flows. |
| 36 |
|
| 37 |
Most of the time, REST session backend is used by Handlers deployed on |
| 38 |
external servers. |
| 39 |
|
| 40 |
To configure it, REST session backend will be set through Manager in |
| 41 |
global configuration (used by all Handlers), and the real session |
| 42 |
backend will be configured for local components in lemonldap-ng.ini. |
| 43 |
|
| 44 |
Setup |
| 45 |
----- |
| 46 |
|
| 47 |
Manager |
| 48 |
~~~~~~~ |
| 49 |
|
| 50 |
First, activate REST in ``General parameters`` » ``Plugins`` » |
| 51 |
``Portal servers`` » ``REST session server``. |
| 52 |
|
| 53 |
Then, set ``Lemonldap::NG::Common::Apache::Session::REST`` in |
| 54 |
``General parameters`` » ``Sessions`` » ``Session storage`` » |
| 55 |
``Apache::Session module`` and add the following parameters (case |
| 56 |
sensitive): |
| 57 |
|
| 58 |
=================== ======================================== ================================================== |
| 59 |
Required parameters |
| 60 |
--------------------------------------------------------------------------------------------------------------- |
| 61 |
Name Comment Example |
| 62 |
=================== ======================================== ================================================== |
| 63 |
**baseUrl** URL of sessions REST end point http://auth.example.com/index.fcgi/sessions/global |
| 64 |
=================== ======================================== ================================================== |
| 65 |
|
| 66 |
=================== ======================================== ================================================== |
| 67 |
Optional parameters |
| 68 |
--------------------------------------------------------------------------------------------------------------- |
| 69 |
Name Comment Example |
| 70 |
=================== ======================================== ================================================== |
| 71 |
**user** Username to use for auth basic mechanism |
| 72 |
**password** Password to use for auth basic mechanism |
| 73 |
**realm** auth basic realm name |
| 74 |
=================== ======================================== ================================================== |
| 75 |
|
| 76 |
`user`, `password` and `realm` parameters are only used if the entry point `index.fcgi/sessions/global` |
| 77 |
is protected by a basic authentication. Thus, handlers will make requests to the Portal |
| 78 |
using these parameters. `realm` is mandatory if basic authentication is used, |
| 79 |
and it must match the `auth_basic` (Nginx) or `AuthType` (Apache) setting in |
| 80 |
your web server. |
| 81 |
|
| 82 |
|
| 83 |
.. attention:: |
| 84 |
|
| 85 |
By default, user password and other secret keys are |
| 86 |
hidden by LL::NG REST server. You can force REST server to export their |
| 87 |
real values by selecting "Export secret attributes in REST" in the |
| 88 |
Manager. This less secure option is disabled by default. |
| 89 |
|
| 90 |
Apache |
| 91 |
~~~~~~ |
| 92 |
|
| 93 |
Sessions REST end points access must be allowed in Apache portal |
| 94 |
configuration (for example, access by IP range): |
| 95 |
|
| 96 |
.. code-block:: apache |
| 97 |
|
| 98 |
# REST/SOAP functions for sessions access (disabled by default) |
| 99 |
<Location /index.fcgi/sessions> |
| 100 |
Require ip 192.168.2.0/24 |
| 101 |
</Location> |
| 102 |
|
| 103 |
Nginx |
| 104 |
~~~~~ |
| 105 |
|
| 106 |
Sessions REST end points access must be allowed in Nginx portal |
| 107 |
configuration (for example, access by IP range): |
| 108 |
|
| 109 |
.. code-block:: nginx |
| 110 |
|
| 111 |
# REST/SOAP functions for sessions access (disabled by default) |
| 112 |
location ~ ^/index.psgi/sessions { |
| 113 |
fastcgi_pass llng_portal_upstream; |
| 114 |
allow 192.168.2.0/24 |
| 115 |
deny all; |
| 116 |
} |
| 117 |
|
| 118 |
Real session backend |
| 119 |
~~~~~~~~~~~~~~~~~~~~ |
| 120 |
|
| 121 |
Real session backend will be configured in ``lemonldap-ng.ini``, in |
| 122 |
``portal`` section (the portal hosts the REST service for sessions, and |
| 123 |
will do the link between REST requests and real sessions). |
| 124 |
|
| 125 |
For example, if real sessions are stored in |
| 126 |
:doc:`files<filesessionbackend>`: |
| 127 |
|
| 128 |
.. code-block:: ini |
| 129 |
|
| 130 |
[portal] |
| 131 |
globalStorage = Apache::Session::File |
| 132 |
globalStorageOptions = { 'Directory' => '/var/lib/lemonldap-ng/sessions/', 'LockDirectory' => '/var/lib/lemonldap-ng/sessions/lock/', } |
| 133 |
|
| 134 |
|
| 135 |
.. tip:: |
| 136 |
|
| 137 |
Session explorer and "single session" features can't be used |
| 138 |
using this backend. Session explorer and portal must be launched with |
| 139 |
real backend. |
| 140 |
|
| 141 |
By default, only few sessions keys are shared by REST |
| 142 |
(authenticationLevel, groups, ipAddr, \_startTime, \_utime, \_lastSeen, |
| 143 |
\_session_id), you need to define which other keys you want to share in |
| 144 |
``General parameters`` » ``Plugins`` » ``Portal servers`` » |
| 145 |
``SOAP/REST exported attributes``. |
| 146 |
|
| 147 |
You must start with ``+`` to keep default keys, else they will not be |
| 148 |
shared. For example: |
| 149 |
|
| 150 |
:: |
| 151 |
|
| 152 |
+ uid cn mail |
| 153 |
|
| 154 |
To share only the listed attributes: |
| 155 |
|
| 156 |
:: |
| 157 |
|
| 158 |
authenticationLevel groups ipAddr _startTime _utime _lastSeen _session_id uid cn mail |
| 159 |
|