Append customParam to globalLogout plugin (#2145)
This commit is contained in:
parent
3a4ab3bbec
commit
082d12ca5f
|
@ -1294,6 +1294,9 @@ qr/^(?:\*\.)?(?:(?:(?:(?:[a-zA-Z0-9][-a-zA-Z0-9]*)?[a-zA-Z0-9])[.])*(?:[a-zA-Z][
|
|||
'default' => 120,
|
||||
'type' => 'int'
|
||||
},
|
||||
'globalLogoutCustomParam' => {
|
||||
'type' => 'text'
|
||||
},
|
||||
'globalLogoutRule' => {
|
||||
'default' => 0,
|
||||
'type' => 'boolOrExpr'
|
||||
|
|
|
@ -494,6 +494,11 @@ sub attributes {
|
|||
documentation => 'Global logout auto accept time',
|
||||
flags => 'p',
|
||||
},
|
||||
globalLogoutCustomParam => {
|
||||
type => 'text',
|
||||
documentation => 'Custom session parameter to display',
|
||||
flags => 'p',
|
||||
},
|
||||
impersonationMergeSSOgroups => {
|
||||
default => 0,
|
||||
type => 'boolOrExpr',
|
||||
|
|
|
@ -709,7 +709,7 @@ sub tree {
|
|||
help => 'globallogout.html',
|
||||
form => 'simpleInputContainer',
|
||||
nodes =>
|
||||
[ 'globalLogoutRule', 'globalLogoutTimer', ],
|
||||
[ 'globalLogoutRule', 'globalLogoutTimer','globalLogoutCustomParam' ],
|
||||
},
|
||||
{
|
||||
title => 'stateCheck',
|
||||
|
|
|
@ -317,6 +317,7 @@
|
|||
"friendlyName":"اسم مألوف",
|
||||
"generalParameters":"المعاييرالعامة",
|
||||
"globalLogout":"Global logout",
|
||||
"globalLogoutCustomParam":"Custom parameter",
|
||||
"globalLogoutRule":"تفعيل",
|
||||
"globalLogoutTimer":"قبول تلقائي للوقت",
|
||||
"globalStorage":"أباتشي :: وحدة الجلسة",
|
||||
|
|
|
@ -317,6 +317,7 @@
|
|||
"friendlyName":"Friendly name",
|
||||
"generalParameters":"General Parameters",
|
||||
"globalLogout":"Global logout",
|
||||
"globalLogoutCustomParam":"Custom parameter",
|
||||
"globalLogoutRule":"Activation",
|
||||
"globalLogoutTimer":"Auto accept time",
|
||||
"globalStorage":"Apache::Session module",
|
||||
|
|
|
@ -317,6 +317,7 @@
|
|||
"friendlyName":"Friendly name",
|
||||
"generalParameters":"General Parameters",
|
||||
"globalLogout":"Global logout",
|
||||
"globalLogoutCustomParam":"Custom parameter",
|
||||
"globalLogoutRule":"Activation",
|
||||
"globalLogoutTimer":"Auto accept time",
|
||||
"globalStorage":"Apache::Session module",
|
||||
|
|
|
@ -317,6 +317,7 @@
|
|||
"friendlyName":"Nom alternatif",
|
||||
"generalParameters":"Paramètres généraux",
|
||||
"globalLogout":"Déconnexion globale",
|
||||
"globalLogoutCustomParam":"Paramètre personnalisé",
|
||||
"globalLogoutRule":"Activation",
|
||||
"globalLogoutTimer":"Délai d'acceptation automatique",
|
||||
"globalStorage":"Module Apache::Session",
|
||||
|
|
|
@ -317,6 +317,7 @@
|
|||
"friendlyName":"Nome amichevole",
|
||||
"generalParameters":"Parametri generali",
|
||||
"globalLogout":"Global logout",
|
||||
"globalLogoutCustomParam":"Custom parameter",
|
||||
"globalLogoutRule":"Attivazione",
|
||||
"globalLogoutTimer":"Auto accettazione tempo",
|
||||
"globalStorage":"Modulo Apache::Session",
|
||||
|
|
|
@ -317,6 +317,7 @@
|
|||
"friendlyName":"Kolay ad",
|
||||
"generalParameters":"Genel Parametreler",
|
||||
"globalLogout":"Global çıkış",
|
||||
"globalLogoutCustomParam":"Custom parameter",
|
||||
"globalLogoutRule":"Aktivasyon",
|
||||
"globalLogoutTimer":"Otomatik kabul süresi",
|
||||
"globalStorage":"Apache::Session modülü",
|
||||
|
|
|
@ -317,6 +317,7 @@
|
|||
"friendlyName":"Tên thân thiện",
|
||||
"generalParameters":"Thông số chung",
|
||||
"globalLogout":"Global logout",
|
||||
"globalLogoutCustomParam":"Custom parameter",
|
||||
"globalLogoutRule":"Activation",
|
||||
"globalLogoutTimer":"Tự động chấp nhận thời gian",
|
||||
"globalStorage":"Mô đun Apache :: Session",
|
||||
|
|
|
@ -317,6 +317,7 @@
|
|||
"friendlyName":"Friendly name",
|
||||
"generalParameters":"通用参数",
|
||||
"globalLogout":"Global logout",
|
||||
"globalLogoutCustomParam":"Custom parameter",
|
||||
"globalLogoutRule":"Activation",
|
||||
"globalLogoutTimer":"自动接收时间",
|
||||
"globalStorage":"Apache::Session 模块",
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -11,7 +11,7 @@ use Lemonldap::NG::Portal::Main::Constants qw(
|
|||
PE_SENDRESPONSE
|
||||
);
|
||||
|
||||
our $VERSION = '2.0.7';
|
||||
our $VERSION = '2.0.8';
|
||||
|
||||
extends qw(
|
||||
Lemonldap::NG::Portal::Main::Plugin
|
||||
|
@ -55,7 +55,7 @@ sub init {
|
|||
}
|
||||
|
||||
# RUNNING METHODS
|
||||
# Look for user active SSO sessions and propose to close them
|
||||
# Look for user active SSO sessions and suggest to close them
|
||||
sub run {
|
||||
my ( $self, $req ) = @_;
|
||||
my $user = $req->{userData}->{ $self->conf->{whatToTrace} };
|
||||
|
@ -102,6 +102,7 @@ sub run {
|
|||
SESSIONS => $sessions,
|
||||
TOKEN => $token,
|
||||
LOGIN => $user,
|
||||
CUSTOMPRM => $self->conf->{globalLogoutCustomParam}
|
||||
}
|
||||
);
|
||||
$req->response($tmp);
|
||||
|
@ -168,10 +169,12 @@ sub activeSessions {
|
|||
my ( $self, $req ) = @_;
|
||||
my $activeSessions = [];
|
||||
my $sessions = {};
|
||||
my $regex = '^(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})$';
|
||||
my $user = $req->{userData}->{ $self->conf->{whatToTrace} };
|
||||
my $customParam = $self->conf->{globalLogoutCustomParam} || '';
|
||||
|
||||
# Try to retrieve session from sessions DB
|
||||
$self->logger->debug('Try to retrieve session from DB');
|
||||
# Try to retrieve sessions from sessions DB
|
||||
$self->logger->debug('Try to retrieve sessions from DB');
|
||||
my $moduleOptions = $self->conf->{globalStorageOptions} || {};
|
||||
$moduleOptions->{backend} = $self->conf->{globalStorage};
|
||||
$self->logger->debug("Looking for \"$user\" sessions...");
|
||||
|
@ -181,12 +184,18 @@ sub activeSessions {
|
|||
|
||||
$self->logger->debug("Building array ref with sessions info...");
|
||||
@$activeSessions = map { {
|
||||
id => $_,
|
||||
UA => $sessions->{$_}->{'UA'},
|
||||
ipAddr => $sessions->{$_}->{'ipAddr'},
|
||||
authLevel => $sessions->{$_}->{'authenticationLevel'},
|
||||
startTime => $sessions->{$_}->{'_startTime'},
|
||||
updateTime => $sessions->{$_}->{'_updateTime'},
|
||||
id => $_,
|
||||
customParam => $sessions->{$_}->{$customParam},
|
||||
ipAddr => $sessions->{$_}->{'ipAddr'},
|
||||
authLevel => $sessions->{$_}->{'authenticationLevel'},
|
||||
startTime => $sessions->{$_}->{'_startTime'} =~
|
||||
s/$regex/$1-$2-$3 $4:$5:$6/ro,
|
||||
updateTime => (
|
||||
$sessions->{$_}->{'_updateTime'}
|
||||
? $sessions->{$_}->{'_updateTime'} =~
|
||||
s/$regex/$1-$2-$3 $4:$5:$6/ro
|
||||
: ''
|
||||
),
|
||||
};
|
||||
} keys %$sessions;
|
||||
|
||||
|
|
|
@ -7,14 +7,16 @@
|
|||
<TMPL_IF NAME="SESSIONS">
|
||||
<div class="card col border-secondary">
|
||||
<div class="text-center bg-light text-dark"><b><span trspan="activeSessions">ACTIVE SSO SESSIONS</span>: <u><TMPL_VAR NAME="LOGIN"></u></b></div>
|
||||
<table class="table table-sm table-hover">
|
||||
<table class="table table-sm table-hover text-center">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col"><span trspan="startTime">startTime</span></th>
|
||||
<th scope="col"><span trspan="updateTime">updateTime</span></th>
|
||||
<th scope="col"><span trspan="authLevel">authLevel</span></th>
|
||||
<th scope="col"><span trspan="ipAddr">ipAddr</span></th>
|
||||
<th scope="col"><span trspan="UA">UA</span></th>
|
||||
<th scope="col"><span trspan="authLevel">authLevel</span></th>
|
||||
<TMPL_IF NAME="CUSTOMPRM">
|
||||
<th scope="col"><TMPL_VAR NAME="CUSTOMPRM"></th>
|
||||
</TMPL_IF>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
@ -22,9 +24,11 @@
|
|||
<tr>
|
||||
<td scope="row"><TMPL_VAR NAME="startTime"></td>
|
||||
<td scope="row"><TMPL_VAR NAME="updateTime"></td>
|
||||
<td scope="row"><TMPL_VAR NAME="authLevel"></td>
|
||||
<td scope="row"><TMPL_VAR NAME="ipAddr"></td>
|
||||
<td scope="row"><TMPL_VAR NAME="UA"></td>
|
||||
<td scope="row"><TMPL_VAR NAME="authLevel"></td>
|
||||
<TMPL_IF NAME="CUSTOMPRM">
|
||||
<td scope="row"><TMPL_VAR NAME="customParam"></td>
|
||||
</TMPL_IF>
|
||||
</tr>
|
||||
</TMPL_LOOP>
|
||||
</tbody>
|
||||
|
|
|
@ -11,14 +11,15 @@ my $res;
|
|||
|
||||
my $client = LLNG::Manager::Test->new( {
|
||||
ini => {
|
||||
logLevel => 'error',
|
||||
authentication => 'Demo',
|
||||
userDB => 'Same',
|
||||
loginHistoryEnabled => 0,
|
||||
bruteForceProtection => 0,
|
||||
requireToken => 0,
|
||||
restSessionServer => 1,
|
||||
globalLogoutRule => '$uid eq "dwho"',
|
||||
logLevel => 'error',
|
||||
authentication => 'Demo',
|
||||
userDB => 'Same',
|
||||
loginHistoryEnabled => 0,
|
||||
bruteForceProtection => 0,
|
||||
requireToken => 0,
|
||||
restSessionServer => 1,
|
||||
globalLogoutRule => '$uid eq "dwho"',
|
||||
globalLogoutCustomParam => 'authMode'
|
||||
}
|
||||
}
|
||||
);
|
||||
|
@ -138,15 +139,17 @@ my ( $host, $url, $query ) =
|
|||
ok( $res->[2]->[0] =~ m%<span trspan="globalLogout">%,
|
||||
'Found trspan="globalLogout"' )
|
||||
or explain( $res->[2]->[0], 'trspan="globalLogout"' );
|
||||
ok( $res->[2]->[0] =~ m%<td scope="row">DEMO</td>%, 'CustomParam found "DEMO"' )
|
||||
or explain( $res->[2]->[0], 'CustomParam DEMO' );
|
||||
my @c = ( $res->[2]->[0] =~ m%<td scope="row">127.0.0.1</td>%gs );
|
||||
my @d = ( $res->[2]->[0] =~ m%<th scope="col"><span trspan="%gs );
|
||||
my @d = ( $res->[2]->[0] =~ m%<th scope="col">%gs );
|
||||
|
||||
## Three entries found
|
||||
ok( @c == 3, ' -> Three entries found' )
|
||||
or explain( $res->[2]->[0], "Number of session(s) found = " . scalar @c );
|
||||
ok( @d == 5, ' -> Five <th> found' )
|
||||
or explain( $res->[2]->[0], "Number of <th> found = " . scalar @d );
|
||||
count(3);
|
||||
count(4);
|
||||
|
||||
## GlobalLogout request for 'dwho'
|
||||
$query .= '&all=1';
|
||||
|
|
Loading…
Reference in New Issue
Block a user