| 1 |
Custom handlers |
| 2 |
=============== |
| 3 |
|
| 4 |
LLNG provides Perl libraries that can be easily used by inheritance. So |
| 5 |
you can write your own handlers but you need first to understand |
| 6 |
:doc:`Handler architecture<handlerarch>` |
| 7 |
|
| 8 |
Add a new handler type |
| 9 |
---------------------- |
| 10 |
|
| 11 |
#. Write your new Module (in Lemonldap/NG/Handler/Lib for example) that |
| 12 |
overload some Lemonldap::NG::Handler::Main methods |
| 13 |
#. Write a wrapper in each platform directory *(see |
| 14 |
Lemonldap::NG::Handler::Apache2::AuthBasic or |
| 15 |
Lemonldap::NG::Handler::Server::AuthBasic for examples)* |
| 16 |
|
| 17 |
Wrapper usually look at this: |
| 18 |
|
| 19 |
.. code-block:: perl |
| 20 |
|
| 21 |
package Lemonldap::NG::Handler::ApacheMP2::MyType; |
| 22 |
|
| 23 |
use base 'Lemonldap::NG::Handler::ApacheMP2::Main', 'Lemonldap::NG::Handler::Lib::MyType'; |
| 24 |
|
| 25 |
1; |
| 26 |
|
| 27 |
Enable it |
| 28 |
~~~~~~~~~ |
| 29 |
|
| 30 |
Your wrappers must be named "Lemonldap::NG::Handler::<platform>::<type>" |
| 31 |
where <platform> is the target (ApacheMP2 or Server) and <type> is the |
| 32 |
name you've chosen. |
| 33 |
|
| 34 |
You can enable it either: |
| 35 |
|
| 36 |
- by setting a ``PerlSetVar VHOSTTYPE <type>`` in the Apache |
| 37 |
configuration file |
| 38 |
- by setting a ``fastcgi_param VHOSTTYPE <type>`` in the Nginx |
| 39 |
configuration file |
| 40 |
- by adding it to the menu: add its name in ``vhostType`` "select" |
| 41 |
declaration (file |
| 42 |
``lemonldap-ng-manager/lib/Lemonldap/NG/Build/Attributes``) and |
| 43 |
rebuild LLNG |
| 44 |
|
| 45 |
Note that configuration parameter can be set only in lemonldap-ng.ini |
| 46 |
configuration file *(section Handler)*. |
| 47 |
|
| 48 |
Add a new platform |
| 49 |
------------------ |
| 50 |
|
| 51 |
LLNG provides 3 platforms: |
| 52 |
|
| 53 |
- ApacheMP2 |
| 54 |
- FastCGI server *(Nginx is built from there)* |
| 55 |
- Auto-protected PSGI |
| 56 |
|
| 57 |
If you want to add another, you must write: |
| 58 |
|
| 59 |
- the platform launcher file that launch the required type (see |
| 60 |
``lemonldap-ng-handler/lib/Lemonldap/NG/Handler/ApacheMP2`` file for |
| 61 |
example) |
| 62 |
- write the main platform file |
| 63 |
(``Lemonldap::NG::Handler::MyPlatform::Main``) that provides required |
| 64 |
method (see ``lemonldap-ng-handler/lib/Lemonldap/NG/Handler/*/Main`` |
| 65 |
for examples) and inherits from ``Lemonldap::NG::Handler::Main`` |
| 66 |
- write the "type" wrapper files (AuthBasic,...). |
| 67 |
|
| 68 |
Wrapper usually look at this: |
| 69 |
|
| 70 |
.. code-block:: perl |
| 71 |
|
| 72 |
package Lemonldap::NG::Handler::MyPlatform::AuthBasic; |
| 73 |
|
| 74 |
use base 'Lemonldap::NG::Handler::MyPlatform::Main', 'Lemonldap::NG::Handler::Lib::AuthBasic'; |
| 75 |
|
| 76 |
1; |
| 77 |
|
| 78 |
Old fashion Nginx handlers |
| 79 |
-------------------------- |
| 80 |
|
| 81 |
|
| 82 |
.. attention:: |
| 83 |
|
| 84 |
There is no need to use this feature now. It is kept for |
| 85 |
compatibility. |
| 86 |
|
| 87 |
Three actions are needed: |
| 88 |
|
| 89 |
- declare your own module in the manager "General Parameters >> |
| 90 |
Advanced Parameters >> Custom handlers (Nginx)". Key is the name that |
| 91 |
will be used below and value is the name of the custom package, |
| 92 |
- in your Nginx configuration file, add ``LLTYPE=<name>;`` in the |
| 93 |
``location = /lmauth {...}`` paragraph |
| 94 |
- restart FastCGI server(s) *(reload is not enough here)* |