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

70 lines
1.4 KiB
Perl
Raw Normal View History

2016-05-25 21:30:43 +02:00
package Lemonldap::NG::Portal::Auth::Slave;
use strict;
use Mouse;
# Add constants used by this module
2020-11-16 21:49:41 +01:00
use Lemonldap::NG::Portal::Main::Constants qw(
PE_OK
PE_FORBIDDENIP
PE_USERNOTFOUND
);
2021-02-01 22:30:37 +01:00
our $VERSION = '2.0.12';
2020-11-16 21:49:41 +01:00
extends qw(
Lemonldap::NG::Portal::Main::Auth
Lemonldap::NG::Portal::Lib::Slave
);
2016-05-25 21:30:43 +02:00
2016-06-09 20:40:20 +02:00
# INITIALIZATION
2016-05-25 21:30:43 +02:00
sub init { 1 }
2016-06-09 20:40:20 +02:00
# RUNNING METHODS
2016-05-25 21:30:43 +02:00
sub extractFormInfo {
my ( $self, $req ) = @_;
return PE_FORBIDDENIP
unless ( $self->checkIP($req) and $self->checkHeader($req) );
unless ( $self->conf->{slaveUserHeader} ) {
2019-09-13 22:11:30 +02:00
$self->logger->debug('slaveUserHeader is undefined');
return PE_USERNOTFOUND;
}
2019-09-13 22:11:30 +02:00
2016-05-25 21:30:43 +02:00
my $user_header = $self->conf->{slaveUserHeader};
$user_header = 'HTTP_' . uc($user_header);
$user_header =~ s/\-/_/g;
unless ( $req->{user} = $req->env->{$user_header} ) {
2017-02-15 07:41:50 +01:00
$self->userLogger->error(
"No header " . $self->conf->{slaveUserHeader} . " found" );
2016-05-25 21:30:43 +02:00
return PE_USERNOTFOUND;
}
2021-02-01 22:30:37 +01:00
return PE_OK;
2016-05-25 21:30:43 +02:00
}
sub authenticate {
my ( $self, $req ) = @_;
2021-02-01 22:30:37 +01:00
return PE_OK;
2016-05-25 21:30:43 +02:00
}
2016-12-01 23:25:05 +01:00
sub setAuthSessionInfo {
my ( $self, $req ) = @_;
$req->{sessionInfo}->{authenticationLevel} = $self->conf->{slaveAuthnLevel};
2021-02-01 22:30:37 +01:00
return PE_OK;
2016-12-01 23:25:05 +01:00
}
2019-08-20 17:08:37 +02:00
sub getDisplayType {
my ($self) = @_;
return ( $self->{conf}->{slaveDisplayLogo} ? "logo" : "_none_" );
2019-08-20 17:08:37 +02:00
}
2016-05-25 21:30:43 +02:00
sub authLogout {
my ( $self, $req ) = @_;
2021-02-01 22:30:37 +01:00
return PE_OK;
2016-05-25 21:30:43 +02:00
}
1;