lemonldap-ng/lemonldap-ng-portal/lib/Lemonldap/NG/Portal.pm

181 lines
5.1 KiB
Perl
Raw Normal View History

2017-02-11 21:07:12 +01:00
# Alias for Lemonldap::NG::Portal::Main
package Lemonldap::NG::Portal;
our $VERSION = '2.0.15.1';
2017-01-17 07:30:56 +01:00
use Lemonldap::NG::Portal::Main;
use base 'Lemonldap::NG::Portal::Main';
1;
__END__
=pod
=encoding utf8
=head1 NAME
Lemonldap::NG::Portal - The authentication portal part of Lemonldap::NG Web-SSO
system.
2017-01-05 08:41:29 +01:00
=head1 SYNOPSIS
Use any of Plack launcher. Example:
#!/usr/bin/env plackup
use Lemonldap::NG::Portal;
2017-01-30 21:21:58 +01:00
# This must be the last instruction! See PSGI for more
2017-01-05 08:41:29 +01:00
Lemonldap::NG::Portal->run($opts);
=head1 DESCRIPTION
Lemonldap::NG is a modular Web-SSO based on Apache::Session modules. It
2018-07-16 11:50:49 +02:00
provides an easy way to build a secured area to protect applications with
very few changes.
2018-07-16 11:50:49 +02:00
Lemonldap::NG manages both authentication and authorization. Furthermore
it provides headers for accounting. So you can have a full AAA protection
for your web space as described below.
2017-01-04 21:51:46 +01:00
Lemonldap::NG::Portal provides portal components. See
L<http://lemonldap-ng.org> for more.
2017-01-17 07:30:56 +01:00
=head1 KINEMATICS
The portal object is based on L<Lemonldap::NG::Handler::Try>: underlying
2018-07-16 11:50:49 +02:00
handler tries to authenticate user and follows initialized auth / unauth
routes.
2017-01-17 07:30:56 +01:00
=head2 Initialization
2018-07-16 11:50:49 +02:00
Initialization process subscribes portal to handler configuration reload and
requests handler initialization (L<Lemonldap::NG::Portal::Main::Init>).
So configuration is read by handler at each reload.
2017-01-17 07:30:56 +01:00
2018-07-16 11:50:49 +02:00
During configuration reload, each enabled components are loaded as plugins:
2017-01-17 07:30:56 +01:00
=over
=item authentication module
=item userDB module
=item other enabled plugins (issuers,...)
=back
2018-07-16 11:50:49 +02:00
init() is called for each plugin. If a plugin initialization fails (init()
2017-01-17 07:30:56 +01:00
returns 0), the portal responds a 500 status code for each request.
2017-01-30 21:21:58 +01:00
See L<Lemonldap::NG::Portal::Main::Plugin> to see how to write modules.
2017-01-17 07:30:56 +01:00
=head2 Main route
2017-01-30 21:21:58 +01:00
The "/" route is declared in L<Lemonldap::NG::Portal::Main::Init>. It points to
2018-07-16 11:50:49 +02:00
different methods in L<Lemonldap::NG::Portal::Main::Run>. Theses methods select
2017-01-17 07:30:56 +01:00
methods to call in the process and call do().
do() stores methods to call in $req->steps and launches
Lemonldap::NG::Portal::Main::Process::process(). This method removes each method
2017-02-07 15:46:28 +01:00
stored in $req->steps and launches it. If the result is PE_OK, process()
2017-01-17 07:30:56 +01:00
continues, else it returns the error code.
2018-07-16 11:50:49 +02:00
If it is an Ajax request, do() responds in JSON format else it manages
2018-07-19 07:55:55 +02:00
redirection if any. Else it calls
2018-07-16 11:50:49 +02:00
Lemonldap::NG::Portal::Main::Display::display() to load template and arguments,
and launches Lemonldap::NG::Common::PSGI::sendHtml() using them.
2017-01-17 07:30:56 +01:00
=head1 DEVELOPER INSTRUCTIONS
Portal main object is defined in Lemonldap::NG::Portal::Main::* classes. Other
2018-07-16 11:50:49 +02:00
components are plugins. Plugins do not have to store any hash key in main object.
2017-01-17 07:30:56 +01:00
2018-07-16 11:50:49 +02:00
Main and plugin keys must be set during initialization process. They must
be read-only during requests receiving.
2017-01-17 07:30:56 +01:00
The L<Lemonldap::NG::Portal::Main::Request> request has fixed keys. A plugin
that wants to store a temporary key must store it in C<$req-E<gt>data> or use
2017-01-17 07:30:56 +01:00
defined keys, but it must never create a root key. Plugin keys may have
explicit names to avoid conflicts.
Whole configuration is always available. It is stored in $self->conf. It must
2018-07-19 07:55:55 +02:00
not be modified by any components even during initialization process or
receiving request (during initialization, copy the value in the plugin
2018-07-16 11:50:49 +02:00
namespace instead).
2017-01-17 07:30:56 +01:00
2018-07-16 11:50:49 +02:00
All plugins can access to portal methods using $self->p which points to
2017-01-17 07:30:56 +01:00
portal main object. Some main methods are mapped to the plugin namespace:
=over
2017-02-15 07:41:50 +01:00
=item logger() accessor to log
=item userLogger() accessor to log user actions
2017-01-17 07:30:56 +01:00
=item error() accessor (use it to store error during initialization)
=back
2017-01-30 21:21:58 +01:00
=head1 SEE ALSO
2017-01-05 06:57:16 +01:00
2018-07-16 11:50:49 +02:00
Most of the documentation is available on L<http://lemonldap-ng.org> website
2017-01-30 21:21:58 +01:00
=head2 OTHER POD FILES
2017-01-05 06:57:16 +01:00
=over
2018-02-19 22:07:20 +01:00
=item Writing an authentication module: L<Lemonldap::NG::Portal::Auth>
2017-01-05 06:57:16 +01:00
2018-02-19 22:07:20 +01:00
=item Writing a UserDB module: L<Lemonldap::NG::Portal::UserDB>
=item Writing a second factor module: L<Lemonldap::NG::Portal::Main::SecondFactor>
2017-03-23 13:14:09 +01:00
2017-01-05 06:57:16 +01:00
=item Writing an issuer module: L<Lemonldap::NG::Portal::Main::Issuer>
2018-03-15 21:20:03 +01:00
=item Writing another plugin: L<Lemonldap::NG::Portal::Main::Plugin>
2017-01-05 06:57:16 +01:00
=item Request object: L<Lemonldap::NG::Portal::Main::Request>
=item Adding parameters in the manager: L<Lemonldap::NG::Manager::Build>
=back
2017-01-04 21:51:46 +01:00
=head1 AUTHORS
=over
2017-01-04 21:51:46 +01:00
=item LemonLDAP::NG team L<http://lemonldap-ng.org/team>
=back
=head1 BUG REPORT
Use OW2 system to report bug or ask for features:
2017-11-11 14:06:23 +01:00
L<https://gitlab.ow2.org/lemonldap-ng/lemonldap-ng/issues>
=head1 DOWNLOAD
Lemonldap::NG is available at
2021-08-12 16:05:42 +02:00
L<https://lemonldap-ng.org/download>
=head1 COPYRIGHT AND LICENSE
2017-01-04 21:51:46 +01:00
See COPYING file for details.
This library is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see L<http://www.gnu.org/licenses/>.
=cut