2016-06-30 22:42:50 +02:00
|
|
|
package Lemonldap::NG::Portal::Auth::Choice;
|
|
|
|
|
|
|
|
use strict;
|
|
|
|
use Mouse;
|
2016-07-02 10:51:00 +02:00
|
|
|
use Lemonldap::NG::Portal::Main::Constants qw(PE_OK PE_FIRSTACCESS);
|
2016-06-30 22:42:50 +02:00
|
|
|
|
2017-02-28 21:53:19 +01:00
|
|
|
our $VERSION = '2.0.0';
|
|
|
|
|
2016-06-30 22:42:50 +02:00
|
|
|
extends 'Lemonldap::NG::Portal::Lib::Choice';
|
|
|
|
|
|
|
|
sub init {
|
|
|
|
return $_[0]->SUPER::init(0);
|
|
|
|
}
|
|
|
|
|
|
|
|
sub extractFormInfo {
|
|
|
|
my ( $self, $req ) = @_;
|
2017-04-25 10:11:16 +02:00
|
|
|
unless ( $self->checkChoice($req) ) {
|
|
|
|
foreach my $mod ( values %{ $self->modules } ) {
|
|
|
|
if ( $mod->can('setSecurity') ) {
|
|
|
|
$mod->setSecurity($req);
|
|
|
|
last;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return PE_FIRSTACCESS;
|
|
|
|
}
|
2016-07-02 21:09:45 +02:00
|
|
|
return $req->datas->{enabledMods0}->[0]->extractFormInfo($req);
|
2016-06-30 22:42:50 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
sub authenticate {
|
2016-07-02 21:09:45 +02:00
|
|
|
return $_[1]->datas->{enabledMods0}->[0]->authenticate( $_[1] );
|
2016-06-30 22:42:50 +02:00
|
|
|
}
|
|
|
|
|
2016-12-01 23:25:05 +01:00
|
|
|
sub setAuthSessionInfo {
|
2017-12-18 10:40:07 +01:00
|
|
|
my ( $self, $req ) = @_;
|
|
|
|
$self->checkChoice($req) unless ( $req->datas->{enabledMods0} );
|
|
|
|
return $req->datas->{enabledMods0}->[0]->setAuthSessionInfo($req);
|
2016-12-01 23:25:05 +01:00
|
|
|
}
|
|
|
|
|
2016-07-18 21:45:05 +02:00
|
|
|
sub authLogout {
|
2016-07-02 10:51:00 +02:00
|
|
|
$_[0]->checkChoice( $_[1] ) or return PE_OK;
|
2016-07-18 21:45:05 +02:00
|
|
|
return $_[1]->datas->{enabledMods0}->[0]->authLogout( $_[1] );
|
2016-06-30 22:42:50 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
1;
|