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

119 lines
2.2 KiB
Perl
Raw Normal View History

2016-04-07 23:31:56 +02:00
package Lemonldap::NG::Portal::Auth::Base;
2016-03-31 22:08:43 +02:00
use strict;
use Mouse;
our $VERSION = '2.0.0';
2016-06-02 23:20:36 +02:00
extends 'Lemonldap::NG::Common::Module';
2016-03-31 22:08:43 +02:00
2016-04-03 08:33:50 +02:00
has authnLevel => ( is => 'rw' );
2016-03-31 22:08:43 +02:00
1;
__END__
=pod
=encoding utf8
=head1 NAME
Lemonldap::NG::Portal::Auth::Base - Base module for LemonLDAP::NG
authentication modules.
=head1 SYNOPSIS
package Lemonldap::NG::Portal::Auth::My;
use strict;
use Mouse;
2016-05-22 14:23:04 +02:00
# Add constants used by this module
use Lemonldap::NG::Portal::Main::Constants qw(PE_OK);
our $VERSION = '0.1';
extends 'Lemonldap::NG::Portal::Auth::Base';
2016-05-25 21:30:43 +02:00
sub init {
...
}
2016-05-22 13:27:37 +02:00
sub extractFormInfo {
my ( $self, $req ) = @_;
...
}
2016-05-22 13:27:37 +02:00
sub authenticate {
my ( $self, $req ) = @_;
...
}
2016-05-22 13:27:37 +02:00
sub authForce {
my ( $self, $req ) = @_;
...
}
2016-05-22 13:27:37 +02:00
sub authLogout {
my ( $self, $req ) = @_;
...
}
sub getDisplayType {
return ...;
}
2016-05-22 13:27:37 +02:00
1;
=head1 DESCRIPTION
This base library must be used to build Lemonldap::NG authentication modules.
Authentication modules are independant objects that are instanciated by
Lemonldap::NG portal. They must provides methods described below.
=head1 METHODS
=head2 Accessors and methods provided by Lemonldap::NG::Portal::Auth::Base
=over
=item p: portal object
=item conf: configuration hash (as reference)
=item lmLog: alias for p->lmLog method
=item error: alias for p->error method
=item authnLevel: Lemonldap::NG authentication level
=back
=head2 Methods that must be provided by an authentication module
=head3 init()
Method launched after object creation (after each configuration reload). It
must return a true value if authentication module is ready, false else.
=head3 Methods called at each request
All these methods must return a Lemonldap::NG::Portal::Main::Constants value.
They are called with one argument: a L<Lemonldap::NG::Portal::Main::Request>
object.
=head4 extractFormInfo($req)
First authentication method called during authentication process. It must set
$req->user that will be used by the userDB object to get user informations.
=head4 authenticate($req)
Last method called during authentication process.
=head4 authForce($req)
=head4 authLogout($req)
=cut