« blib/lib/Lemonldap/NG/Portal/Main/Constants.pm
↑ Summary
blib/lib/Lemonldap/NG/Portal/Auth/Custom.pm »
| 1 | # Alias for Lemonldap::NG::Portal::Main | ||
| 2 | package Lemonldap::NG::Portal; | ||
| 3 | |||
| 4 | 442 | our $VERSION = '2.23.0'; | |
| 5 | 442 | ▶ | use Lemonldap::NG::Portal::Main; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | 442 | ▶ | use base 'Lemonldap::NG::Portal::Main'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 7 | |||
| 8 | 442 | 1; | |
| 9 | |||
| 10 | __END__ | ||
| 11 | |||
| 12 | =pod | ||
| 13 | |||
| 14 | =encoding utf8 | ||
| 15 | |||
| 16 | =head1 NAME | ||
| 17 | |||
| 18 | Lemonldap::NG::Portal - The authentication portal part of Lemonldap::NG Web-SSO | ||
| 19 | system. | ||
| 20 | |||
| 21 | =head1 SYNOPSIS | ||
| 22 | |||
| 23 | Use any of Plack launcher. Example: | ||
| 24 | |||
| 25 | #!/usr/bin/env plackup | ||
| 26 | |||
| 27 | use Lemonldap::NG::Portal; | ||
| 28 | |||
| 29 | # This must be the last instruction! See PSGI for more | ||
| 30 | Lemonldap::NG::Portal->run($opts); | ||
| 31 | |||
| 32 | =head1 DESCRIPTION | ||
| 33 | |||
| 34 | Lemonldap::NG is a modular Web-SSO based on Apache::Session modules. It | ||
| 35 | provides an easy way to build a secured area to protect applications with | ||
| 36 | very few changes. | ||
| 37 | |||
| 38 | Lemonldap::NG manages both authentication and authorization. Furthermore | ||
| 39 | it provides headers for accounting. So you can have a full AAA protection | ||
| 40 | for your web space as described below. | ||
| 41 | |||
| 42 | Lemonldap::NG::Portal provides portal components. See | ||
| 43 | L<http://lemonldap-ng.org> for more. | ||
| 44 | |||
| 45 | =head1 KINEMATICS | ||
| 46 | |||
| 47 | The portal object is based on L<Lemonldap::NG::Handler::Try>: underlying | ||
| 48 | handler tries to authenticate user and follows initialized auth / unauth | ||
| 49 | routes. | ||
| 50 | |||
| 51 | =head2 Initialization | ||
| 52 | |||
| 53 | Initialization process subscribes portal to handler configuration reload and | ||
| 54 | requests handler initialization (L<Lemonldap::NG::Portal::Main::Init>). | ||
| 55 | So configuration is read by handler at each reload. | ||
| 56 | |||
| 57 | During configuration reload, each enabled components are loaded as plugins: | ||
| 58 | |||
| 59 | =over | ||
| 60 | |||
| 61 | =item authentication module | ||
| 62 | |||
| 63 | =item userDB module | ||
| 64 | |||
| 65 | =item other enabled plugins (issuers,...) | ||
| 66 | |||
| 67 | =back | ||
| 68 | |||
| 69 | init() is called for each plugin. If a plugin initialization fails (init() | ||
| 70 | returns 0), the portal responds a 500 status code for each request. | ||
| 71 | |||
| 72 | See L<Lemonldap::NG::Portal::Main::Plugin> to see how to write modules. | ||
| 73 | |||
| 74 | =head2 Main route | ||
| 75 | |||
| 76 | The "/" route is declared in L<Lemonldap::NG::Portal::Main::Init>. It points to | ||
| 77 | different methods in L<Lemonldap::NG::Portal::Main::Run>. Theses methods select | ||
| 78 | methods to call in the process and call do(). | ||
| 79 | |||
| 80 | do() stores methods to call in $req->steps and launches | ||
| 81 | Lemonldap::NG::Portal::Main::Process::process(). This method removes each method | ||
| 82 | stored in $req->steps and launches it. If the result is PE_OK, process() | ||
| 83 | continues, else it returns the error code. | ||
| 84 | |||
| 85 | If it is an Ajax request, do() responds in JSON format else it manages | ||
| 86 | redirection if any. Else it calls | ||
| 87 | Lemonldap::NG::Portal::Main::Display::display() to load template and arguments, | ||
| 88 | and launches Lemonldap::NG::Common::PSGI::sendHtml() using them. | ||
| 89 | |||
| 90 | =head1 DEVELOPER INSTRUCTIONS | ||
| 91 | |||
| 92 | Portal main object is defined in Lemonldap::NG::Portal::Main::* classes. Other | ||
| 93 | components are plugins. Plugins do not have to store any hash key in main object. | ||
| 94 | |||
| 95 | Main and plugin keys must be set during initialization process. They must | ||
| 96 | be read-only during requests receiving. | ||
| 97 | |||
| 98 | The L<Lemonldap::NG::Portal::Main::Request> request has fixed keys. A plugin | ||
| 99 | that wants to store a temporary key must store it in C<$req-E<gt>data> or use | ||
| 100 | defined keys, but it must never create a root key. Plugin keys may have | ||
| 101 | explicit names to avoid conflicts. | ||
| 102 | |||
| 103 | Whole configuration is always available. It is stored in $self->conf. It must | ||
| 104 | not be modified by any components even during initialization process or | ||
| 105 | receiving request (during initialization, copy the value in the plugin | ||
| 106 | namespace instead). | ||
| 107 | |||
| 108 | All plugins can access to portal methods using $self->p which points to | ||
| 109 | portal main object. Some main methods are mapped to the plugin namespace: | ||
| 110 | |||
| 111 | =over | ||
| 112 | |||
| 113 | =item logger() accessor to log | ||
| 114 | |||
| 115 | =item userLogger() accessor to log user actions | ||
| 116 | |||
| 117 | =item error() accessor (use it to store error during initialization) | ||
| 118 | |||
| 119 | =back | ||
| 120 | |||
| 121 | =head1 SEE ALSO | ||
| 122 | |||
| 123 | Most of the documentation is available on L<http://lemonldap-ng.org> website | ||
| 124 | |||
| 125 | =head2 OTHER POD FILES | ||
| 126 | |||
| 127 | =over | ||
| 128 | |||
| 129 | =item Writing an authentication module: L<Lemonldap::NG::Portal::Auth> | ||
| 130 | |||
| 131 | =item Writing a UserDB module: L<Lemonldap::NG::Portal::UserDB> | ||
| 132 | |||
| 133 | =item Writing a second factor module: L<Lemonldap::NG::Portal::Main::SecondFactor> | ||
| 134 | |||
| 135 | =item Writing an issuer module: L<Lemonldap::NG::Portal::Main::Issuer> | ||
| 136 | |||
| 137 | =item Writing another plugin: L<Lemonldap::NG::Portal::Main::Plugin> | ||
| 138 | |||
| 139 | =item Request object: L<Lemonldap::NG::Portal::Main::Request> | ||
| 140 | |||
| 141 | =item Adding parameters in the manager: L<Lemonldap::NG::Manager::Build> | ||
| 142 | |||
| 143 | =back | ||
| 144 | |||
| 145 | =head1 AUTHORS | ||
| 146 | |||
| 147 | =over | ||
| 148 | |||
| 149 | =item LemonLDAP::NG team L<http://lemonldap-ng.org/team> | ||
| 150 | |||
| 151 | =back | ||
| 152 | |||
| 153 | =head1 BUG REPORT | ||
| 154 | |||
| 155 | Use OW2 system to report bug or ask for features: | ||
| 156 | L<https://gitlab.ow2.org/lemonldap-ng/lemonldap-ng/issues> | ||
| 157 | |||
| 158 | =head1 DOWNLOAD | ||
| 159 | |||
| 160 | Lemonldap::NG is available at | ||
| 161 | L<https://lemonldap-ng.org/download> | ||
| 162 | |||
| 163 | =head1 COPYRIGHT AND LICENSE | ||
| 164 | |||
| 165 | See COPYING file for details. | ||
| 166 | |||
| 167 | This library is free software; you can redistribute it and/or modify | ||
| 168 | it under the terms of the GNU General Public License as published by | ||
| 169 | the Free Software Foundation; either version 2, or (at your option) | ||
| 170 | any later version. | ||
| 171 | |||
| 172 | This program is distributed in the hope that it will be useful, | ||
| 173 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 174 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 175 | GNU General Public License for more details. | ||
| 176 | |||
| 177 | You should have received a copy of the GNU General Public License | ||
| 178 | along with this program. If not, see L<http://www.gnu.org/licenses/>. | ||
| 179 | |||
| 180 | =cut | ||