Debian Codegraph @

doc/sources/admin/authbasichandler.rst

raw
1 AuthBasic Handler
2 =================
3
4 Presentation
5 ------------
6
7 The AuthBasic Handler is a special Handler using AuthBasic method to
8 authenticate and grante access to a virtual host.
9
10 The Handler sends a WWW-Authenticate header to the client, to request
11 user id and password. Then it checks credentials by using LL::NG REST
12 web service (REST session service must be enabled in the manager). Once
13 session is granted, the Handler will check authorizations like the
14 standard Handler.
15
16 This feature can be useful to allow a third party application to access
17 a virtual host with user credentials by sending a Basic challenge to it.
18
19 Configuration
20 -------------
21
22 Portal
23 ~~~~~~
24
25 :doc:`REST server<restservices>` must be enabled on portal.
26
27 Virtual host
28 ~~~~~~~~~~~~
29
30 You just have to set "Type: AuthBasic" in the virtualHost options in the
31 manager.
32
33 If you want to protect only a virtualHost part (location), keep type on "Main"
34 and set type in your configuration file:
35
36 - Apache: use simply a ``PerlSetVar VHOSTTYPE AuthBasic``
37 - Nginx: create another FastCGI with a
38 ``fastcgi_param VHOSTTYPE AuthBasic;`` *(and remove error_page 401)*
39
40 Handler parameters
41 ~~~~~~~~~~~~~~~~~~
42
43 No parameters needed. But you have to allow REST sessions web services,
44 see :doc:`REST sessions backend<restsessionbackend>`, enable local cache
45 (enabled by default in lemonldap-ng.ini) and allow source IP addresses
46 to access required locations in Portal Virtual Host.
47
48
49 .. danger::
50
51 With AuthBasic Handler, you have to disable CSRF token by
52 setting a special rule based on source IP addresses like this :
53
54 requireToken => $env->{REMOTE_ADDR} !~ /^127\.0\.[1-3]\.1$/
55
56 With :doc:`authchoice`, you have to declare which authentication module is
57 requested by the AuthBasic Handler to create global session.
58
59 Go to:
60 ``General Parameters > Authentication parameters > Choice parameters``
61
62 and set authentication module's name :
63
64 **Choice used for password authentication** => 2_LDAP (by example)
65
66
67 .. attention::
68
69 With HTTPS, you may have to set **LWP::UserAgent object**
70 with ``verify_hostname => 0`` and ``SSL_verify_mode => 0``.
71
72 Go to:
73
74 ``General Parameters > Advanced Parameters > Security > SSL options for server requests``
75