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

65 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
use Lemonldap::NG::Portal::Main::Constants
qw(PE_OK PE_FORBIDDENIP PE_USERNOTFOUND);
use Lemonldap::NG::Portal::Lib::Slave;
our $VERSION = '2.0.6';
2016-05-25 21:30:43 +02:00
2018-02-19 22:11:43 +01:00
extends 'Lemonldap::NG::Portal::Main::Auth';
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;
}
PE_OK;
}
sub authenticate {
my ( $self, $req ) = @_;
PE_OK;
}
2016-12-01 23:25:05 +01:00
sub setAuthSessionInfo {
my ( $self, $req ) = @_;
$req->{sessionInfo}->{authenticationLevel} = $self->conf->{slaveAuthnLevel};
PE_OK;
}
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 ) = @_;
PE_OK;
}
1;