From dece7d8aa01f6e71ab3c3e9a918eb9919d6a80bc Mon Sep 17 00:00:00 2001 From: Christophe Maudoux Date: Mon, 27 May 2019 22:41:51 +0200 Subject: [PATCH] Allow double sessions for double cookies (#1775) --- .../lib/Lemonldap/NG/Portal/Plugins/SingleSession.pm | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Plugins/SingleSession.pm b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Plugins/SingleSession.pm index 71fb40131..441819fe2 100644 --- a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Plugins/SingleSession.pm +++ b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Plugins/SingleSession.pm @@ -17,7 +17,7 @@ sub run { my ( $self, $req ) = @_; my $deleted = []; my $otherSessions = []; - + my $httpSessionId = ''; my $moduleOptions = $self->conf->{globalStorageOptions} || {}; $moduleOptions->{backend} = $self->conf->{globalStorage}; @@ -26,8 +26,17 @@ sub run { $self->conf->{whatToTrace}, $req->{sessionInfo}->{ $self->conf->{whatToTrace} } ); + + if ( $self->conf->{securedCookie} == 2 ){ + $self->logger->debug("Looking for double sessions..."); + foreach my $id ( keys %$sessions ) { + $httpSessionId = $sessions->{$id}->{_session_id} if $sessions->{$id}->{_httpSessionType}; + } + } + foreach my $id ( keys %$sessions ) { next if ( $req->id eq $id ); + next if ( $httpSessionId and $id eq $httpSessionId ); my $session = $self->p->getApacheSession($id) or next; if ( $self->conf->{singleSession}