2016-05-19 07:11:50 +02:00
|
|
|
package Lemonldap::NG::Portal::Auth::DBI;
|
|
|
|
|
|
|
|
use strict;
|
|
|
|
use Mouse;
|
2016-05-22 14:22:59 +02:00
|
|
|
use Lemonldap::NG::Portal::Main::Constants qw(PE_OK PE_BADCREDENTIALS);
|
2016-05-19 07:11:50 +02:00
|
|
|
|
|
|
|
our $VERSION = '2.0.0';
|
|
|
|
|
|
|
|
extends 'Lemonldap::NG::Portal::Auth::_WebForm',
|
|
|
|
'Lemonldap::NG::Portal::Lib::DBI';
|
|
|
|
|
2017-01-25 12:51:30 +01:00
|
|
|
# INTIALIZATION
|
|
|
|
|
|
|
|
sub init {
|
|
|
|
my ($self) = @_;
|
|
|
|
return ( $self->Lemonldap::NG::Portal::Auth::_WebForm::init
|
|
|
|
and $self->Lemonldap::NG::Portal::Lib::DBI::init );
|
|
|
|
}
|
|
|
|
|
2019-02-11 11:55:51 +01:00
|
|
|
has authnLevel => (
|
|
|
|
is => 'rw',
|
|
|
|
lazy => 1,
|
|
|
|
default => sub {
|
|
|
|
$_[0]->conf->{dbiAuthnLevel};
|
|
|
|
}
|
|
|
|
);
|
|
|
|
|
2016-06-09 20:40:20 +02:00
|
|
|
# RUNNING METHODS
|
|
|
|
|
2016-05-19 07:11:50 +02:00
|
|
|
sub authenticate {
|
|
|
|
my ( $self, $req ) = @_;
|
2017-03-14 17:52:11 +01:00
|
|
|
if ( $self->check_password($req) ) {
|
|
|
|
return PE_OK;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$self->setSecurity($req);
|
|
|
|
return PE_BADCREDENTIALS;
|
|
|
|
}
|
2016-05-19 07:11:50 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
sub authLogout {
|
|
|
|
PE_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
1;
|