WIP - Append PortalForceReAuthn (#1507)
parent
107b0386b9
commit
85c6ad2498
@ -0,0 +1,35 @@ |
||||
package Lemonldap::NG::Portal::Plugins::PortalForceReAuthn; |
||||
|
||||
use Data::Dumper; |
||||
use strict; |
||||
use Mouse; |
||||
use Lemonldap::NG::Portal::Main::Constants qw(PE_OK PE_MUSTREAUTHN); |
||||
|
||||
our $VERSION = '2.0.0'; |
||||
|
||||
extends 'Lemonldap::NG::Portal::Main::Plugin'; |
||||
|
||||
# INITIALIZATION |
||||
|
||||
use constant forAuthUser => 'run'; |
||||
|
||||
sub init {1} |
||||
|
||||
# RUNNING METHOD |
||||
|
||||
sub run { |
||||
my ( $self, $req ) = @_; |
||||
my $portalURL = $self->conf->{portal}; |
||||
my $HTTP_HOST = $req->env->{HTTP_HOST}; |
||||
$self->logger->debug( "Portal URL -> " . Dumper($portalURL) ); |
||||
$self->logger->debug( "HTTP_HOST -> " . Dumper($HTTP_HOST) ); |
||||
if ( $req->env->{HTTP_HOST} and $portalURL =~ qr#\Q$HTTP_HOST# ) { |
||||
my $delta = time() - $req->{sessionInfo}->{_utime}; |
||||
$self->logger->debug( "Delta with last Authn -> " . $delta ); |
||||
$delta <= $self->conf->{portalForceReAuthnTempo} |
||||
? return PE_OK |
||||
: return PE_MUSTREAUTHN; |
||||
} |
||||
} |
||||
|
||||
1; |
Loading…
Reference in new issue