Commit 7a7751e5 authored by Christophe Maudoux's avatar Christophe Maudoux 🐛

Code refactoring & typos (#2334)

parent 47151b60
Pipeline #10080 passed with stage
in 19 minutes and 24 seconds
......@@ -54,9 +54,9 @@ sub run {
my ( $self, $req ) = @_;
my $user = $req->{userData}->{ $self->conf->{whatToTrace} };
# Check activation rules
# Check activation rule
unless ( $self->rule->( $req, $req->userData ) ) {
$self->userLogger->info("Global logout not required for $user");
$self->userLogger->info("GlobaLogout not allowed for $user");
return PE_OK;
}
......@@ -116,20 +116,22 @@ sub globalLogout {
# Read active sessions from token
my $sessions = eval { from_json( $token->{sessions} ) };
if ($@) {
$self->logger->error("Bad encoding in OTT: $@");
$self->logger->error(
"GlobalLogout: bad encoding in OTT ($@)");
$res = PE_ERROR;
}
my $as;
foreach (@$sessions) {
unless ( $as = $self->p->getApacheSession( $_->{id} ) ) {
$self->userLogger->info(
"GlobalLogout: session $_->{id} expired");
next;
}
my $user = $token->{user};
if ( $req->{userData}->{ $self->{conf}->{whatToTrace} } eq
$user )
{
my $user = $token->{user};
my $req_user =
$req->{userData}->{ $self->{conf}->{whatToTrace} };
if ( $req_user eq $user ) {
foreach (@$sessions) {
unless ( $as = $self->p->getApacheSession( $_->{id} ) )
{
$self->userLogger->info(
"GlobalLogout: session $_->{id} expired");
next;
}
unless ( $req->{userData}->{_session_id} eq $_->{id} ) {
$self->userLogger->info(
"Remove \"$user\" session: $_->{id}");
......@@ -137,11 +139,12 @@ sub globalLogout {
$count++;
}
}
else {
$self->userLogger->warn(
"GlobalLogout called with an invalid token");
$res = PE_TOKENEXPIRED;
}
}
else {
$self->userLogger->warn(
"GlobalLogout called with an invalid token: $req_user is NOT $user"
);
$res = PE_TOKENEXPIRED;
}
}
else {
......@@ -157,7 +160,7 @@ sub globalLogout {
}
return $self->p->do( $req, [ sub { $res } ] ) if $res;
$self->userLogger->info("$count remaining session(s) have been removed");
$self->userLogger->info("$count remaining session(s) removed");
return $self->p->do( $req, [ 'authLogout', 'deleteSession' ] );
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment