diff --git a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Plugins/Impersonation.pm b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Plugins/Impersonation.pm index e71b86d9f..1eb946e5a 100644 --- a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Plugins/Impersonation.pm +++ b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Plugins/Impersonation.pm @@ -55,6 +55,7 @@ sub init { sub run { my ( $self, $req ) = @_; + my $savedHttpSession = $req->{sessionInfo}->{_httpSession} //= ''; my $spoofId = $req->param('spoofId') || $req->{user}; $self->logger->debug("No impersonation required") if ( $spoofId eq $req->{user} ); my $statut = PE_OK; @@ -139,6 +140,8 @@ sub run { $self->p->updateSession( $req, $spoofSession ); $req->steps( [ $self->p->validSession, @{ $self->p->endAuth } ] ); + # Restore _httpSession for double Cookies + $req->{sessionInfo}->{_httpSession} = $savedHttpSession if $savedHttpSession; return $statut; }