WIP - Append PortalForceAuthn plugin (#1507)
This commit is contained in:
parent
6837304f9b
commit
a82939ee4b
|
@ -217,6 +217,21 @@ sub display {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
elsif ( $req->error == PE_MUSTAUTHN ) {
|
||||||
|
$skinfile = 'updatesession';
|
||||||
|
%templateParams = (
|
||||||
|
MSG => 'PE87',
|
||||||
|
CONFIRMKEY => $self->stamp,
|
||||||
|
PORTAL => $self->conf->{portal},
|
||||||
|
URL => $req->data->{_url},
|
||||||
|
(
|
||||||
|
$req->data->{customScript}
|
||||||
|
? ( CUSTOM_SCRIPT => $req->data->{customScript} )
|
||||||
|
: ()
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
# 2.3 Case : user authenticated but an error was returned (bad url,...)
|
# 2.3 Case : user authenticated but an error was returned (bad url,...)
|
||||||
elsif (
|
elsif (
|
||||||
$req->noLoginDisplay
|
$req->noLoginDisplay
|
||||||
|
|
|
@ -3,7 +3,7 @@ package Lemonldap::NG::Portal::Plugins::PortalForceAuthn;
|
||||||
use Data::Dumper;
|
use Data::Dumper;
|
||||||
use strict;
|
use strict;
|
||||||
use Mouse;
|
use Mouse;
|
||||||
use Lemonldap::NG::Portal::Main::Constants qw(PE_OK PE_MUSTREAUTHN);
|
use Lemonldap::NG::Portal::Main::Constants qw(PE_OK PE_MUSTAUTHN);
|
||||||
|
|
||||||
our $VERSION = '2.0.0';
|
our $VERSION = '2.0.0';
|
||||||
|
|
||||||
|
@ -19,16 +19,21 @@ sub init {1}
|
||||||
|
|
||||||
sub run {
|
sub run {
|
||||||
my ( $self, $req ) = @_;
|
my ( $self, $req ) = @_;
|
||||||
my $portalURL = $self->conf->{portal};
|
$self->logger->debug( "********* " . Dumper($req) );
|
||||||
my $HTTP_HOST = $req->env->{HTTP_HOST};
|
my $portalURL = $self->conf->{portal} || '';
|
||||||
|
my $HTTP_HOST = $req->env->{HTTP_HOST} || '';
|
||||||
|
my $referer = $req->env->{HTTP_REFERER} || '';
|
||||||
|
|
||||||
$self->logger->debug( "Portal URL -> " . Dumper($portalURL) );
|
$self->logger->debug( "Portal URL -> " . Dumper($portalURL) );
|
||||||
$self->logger->debug( "HTTP_HOST -> " . Dumper($HTTP_HOST) );
|
$self->logger->debug( "HTTP_HOST -> " . Dumper($HTTP_HOST) );
|
||||||
|
|
||||||
if ( $req->env->{HTTP_HOST} and $portalURL =~ qr#\Q$HTTP_HOST# ) {
|
if ( $req->env->{HTTP_HOST} and $portalURL =~ qr#\Q$HTTP_HOST# ) {
|
||||||
my $delta = time() - $req->{sessionInfo}->{_utime};
|
my $delta = time() - $req->{sessionInfo}->{_utime};
|
||||||
$self->logger->debug( "Delta with last Authn -> " . $delta );
|
$self->logger->debug( "Delta with last Authn -> " . $delta );
|
||||||
|
|
||||||
$delta <= $self->conf->{portalForceAuthnInterval}
|
$delta <= $self->conf->{portalForceAuthnInterval}
|
||||||
? return PE_OK
|
? return PE_OK
|
||||||
: return PE_MUSTREAUTHN;
|
: return PE_MUSTAUTHN;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,20 @@
|
||||||
|
<TMPL_INCLUDE NAME="header.tpl">
|
||||||
|
|
||||||
|
<div id="errorcontent" class="container">
|
||||||
|
|
||||||
|
<div class="message message-positive alert"><span trspan="<TMPL_VAR NAME="MSG">"></span></div>
|
||||||
|
|
||||||
|
<form id="upgrd" action="/upgradesession" method="post" class="password" role="form">
|
||||||
|
<input type="hidden" name="confirm" value="<TMPL_VAR NAME="CONFIRMKEY">">
|
||||||
|
<input type="hidden" name="url" value="<TMPL_VAR NAME="URL">">
|
||||||
|
<div class="buttons">
|
||||||
|
<button type="submit" class="btn btn-success">
|
||||||
|
<span class="fa fa-sign-in"></span>
|
||||||
|
<span trspan="upgradeSession">Upgrade session</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<TMPL_INCLUDE NAME="footer.tpl">
|
Loading…
Reference in New Issue
Block a user