Avoid session conflict between Issuer and Auth CAS (#1468)

This commit is contained in:
Xavier Guimard 2018-06-30 07:44:05 +02:00
parent ece95d3da2
commit a5cc73a54c
3 changed files with 17 additions and 4 deletions

View File

@ -20,6 +20,7 @@ extends 'Lemonldap::NG::Portal::Main::Auth', 'Lemonldap::NG::Portal::Lib::CAS';
has srvNumber => ( is => 'rw', default => 0 );
has srvList => ( is => 'rw', default => sub { [] } );
use constant sessionKind => 'CAS';
# INITIALIZATION

View File

@ -20,7 +20,8 @@ extends 'Lemonldap::NG::Portal::Main::Issuer',
# INITIALIZATION
use constant beforeAuth => 'storeEnvAndCheckGateway';
use constant beforeAuth => 'storeEnvAndCheckGateway';
use constant sessionKind => 'ICAS';
sub init {
my ($self) = @_;

View File

@ -106,7 +106,7 @@ sub getCasSession {
cacheModule => $self->conf->{localSessionStorage},
cacheModuleOptions => $self->conf->{localSessionStorageOptions},
id => $id,
kind => "CAS",
kind => $self->sessionKind,
( $info ? ( info => $info ) : () ),
}
);
@ -255,7 +255,12 @@ sub deleteCasSecondarySessions {
my $cas_sessions =
$module->searchOn( $moduleOptions, "_cas_id", $session_id );
if ( my @cas_sessions_keys = keys %$cas_sessions ) {
if (
my @cas_sessions_keys =
grep { $cas_sessions->{$_}->{_session_kind} eq $self->sessionKind }
keys %$cas_sessions
)
{
foreach my $cas_session (@cas_sessions_keys) {
@ -404,7 +409,13 @@ sub validateST {
my $pgtIdSessions =
$module->searchOn( $moduleOptions, "pgtIou", $pgtIou );
foreach my $id ( keys %$pgtIdSessions ) {
foreach my $id (
grep {
$pgtIdSessions->{$_}->{_session_kind} eq $self->sessionKind
}
keys %$pgtIdSessions
)
{
# There should be only on session
my $pgtIdSession = $self->getCasSession($id) or next;