| 1 |
REST auth/user/password backend |
| 2 |
=============================== |
| 3 |
|
| 4 |
LL::NG Portal provides REST end points for auth/user/password: |
| 5 |
|
| 6 |
- POST /proxy/pwdConfirm: check password |
| 7 |
- POST /proxy/getUser: get user data |
| 8 |
- POST /proxy/pwdReset: update password |
| 9 |
|
| 10 |
These end points can be used to connect another LemonLDAP::NG server using :doc:`REST authentication backend<authrest>`. |
| 11 |
|
| 12 |
API |
| 13 |
--- |
| 14 |
|
| 15 |
Password confirm |
| 16 |
~~~~~~~~~~~~~~~~ |
| 17 |
|
| 18 |
POST a JSON structure with ``user`` and ``password``. |
| 19 |
It will return a JSON structure with ``result`` parameter (``true`` or ``false``). |
| 20 |
|
| 21 |
Request: |
| 22 |
|
| 23 |
.. code:: |
| 24 |
|
| 25 |
curl -H "Accept: application/json" -d '{"user":"dwho","password":"dwho"}' https://auth.example.com/proxy/pwdConfirm |
| 26 |
|
| 27 |
Response: |
| 28 |
|
| 29 |
.. code-block:: javascript |
| 30 |
|
| 31 |
{"result":true} |
| 32 |
|
| 33 |
Get user data |
| 34 |
~~~~~~~~~~~~~ |
| 35 |
|
| 36 |
POST a JSON structure with ``user``. |
| 37 |
It will return a JSON structure with ``result`` and ``info`` parameters. |
| 38 |
|
| 39 |
Request: |
| 40 |
|
| 41 |
.. code:: |
| 42 |
|
| 43 |
curl -H "Accept: application/json" -d '{"user":"rtyler"}' https://auth.example.com/proxy/getUser |
| 44 |
|
| 45 |
Response: |
| 46 |
|
| 47 |
.. code-block:: javascript |
| 48 |
|
| 49 |
{"info":{"_utime":1651055131,"hGroups":{"users":{"name":"users"},"earthlings":{"name":"earthlings"}},"ipAddr":"127.0.0.1","_auth":"Demo","_url":null,"uid":"rtyler","mail":"[email protected]","_userDB":"Demo","_startTime":"20220427122531","UA":"curl/7.68.0","cn":"Rose Tyler","_user":"rtyler","_language":"en","groups":"users; earthlings","_whatToTrace":"rtyler"},"result":true} |
| 50 |
|
| 51 |
Update password |
| 52 |
~~~~~~~~~~~~~~~ |
| 53 |
|
| 54 |
POST a JSON structure with ``user`` or ``mail`` and ``password``. |
| 55 |
It will return a JSON structure with ``result`` parameter. |
| 56 |
|
| 57 |
Request: |
| 58 |
|
| 59 |
.. code:: |
| 60 |
|
| 61 |
curl -H "Accept: application/json" -d '{"user":"rtyler","password":"secret"}' https://auth.example.com/proxy/pwdReset |
| 62 |
|
| 63 |
Response: |
| 64 |
|
| 65 |
.. code-block:: javascript |
| 66 |
|
| 67 |
{"result":true} |
| 68 |
|
| 69 |
Setup |
| 70 |
----- |
| 71 |
|
| 72 |
Manager |
| 73 |
~~~~~~~ |
| 74 |
|
| 75 |
First, activate REST in ``General parameters`` » ``Plugins`` » |
| 76 |
``Portal servers`` » ``REST authentication server`` and ``REST password reset server``. |
| 77 |
|
| 78 |
Apache |
| 79 |
~~~~~~ |
| 80 |
|
| 81 |
REST end points access must be allowed in Apache portal |
| 82 |
configuration (for example, access by IP range): |
| 83 |
|
| 84 |
.. code-block:: apache |
| 85 |
|
| 86 |
# REST/SOAP functions for proxy auth and password reset (disabled by default) |
| 87 |
<Location /index.fcgi/proxy> |
| 88 |
Require ip 192.168.2.0/24 |
| 89 |
</Location> |
| 90 |
|