Commit dfd286c9 authored by Christophe Maudoux's avatar Christophe Maudoux 🐛

Compute spoofed session with real and spoofed attributes (#1664)

parent 09281f8d
...@@ -86,14 +86,22 @@ sub run { ...@@ -86,14 +86,22 @@ sub run {
$self->logger->debug("Delete $k"); $self->logger->debug("Delete $k");
delete $req->{sessionInfo}->{$k}; delete $req->{sessionInfo}->{$k};
} }
$req->{user} = $spoofId;
$spoofSession = $self->_userDatas($req);
# Compute Macros and Groups with real and spoofed sessions
$req->{sessionInfo} = {%$realSession};
$req->{user} = $spoofId;
$spoofSession = $self->_userDatas($req);
return $req->error if $req->error; return $req->error if $req->error;
$spoofSession->{groups} ||= ''; # Update spoofed session
foreach (qw (_auth _userDB)) {
$self->logger->debug("Processing $_...");
$spk = "$self->{conf}->{impersonationPrefix}$_";
$spoofSession->{$_} = $realSession->{$spk};
}
# Merging SSO groups and hGroups & Dedup # Merging SSO groups and hGroups & Dedup
$spoofSession->{groups} ||= '';
if ( $self->{conf}->{impersonationMergeSSOgroups} ) { if ( $self->{conf}->{impersonationMergeSSOgroups} ) {
$self->userLogger->warn("MERGING SSO groups and hGroups..."); $self->userLogger->warn("MERGING SSO groups and hGroups...");
my $spg = "$self->{conf}->{impersonationPrefix}groups"; my $spg = "$self->{conf}->{impersonationPrefix}groups";
...@@ -116,14 +124,6 @@ sub run { ...@@ -116,14 +124,6 @@ sub run {
{ %{ $spoofSession->{hGroups} }, %{ $realSession->{$sphg} } }; { %{ $spoofSession->{hGroups} }, %{ $realSession->{$sphg} } };
} }
# Create spoofed session
foreach (qw (_auth _userDB)) {
$self->logger->debug("Processing $_...");
$spk = "$self->{conf}->{impersonationPrefix}$_";
$spoofSession->{$_} = $realSession->{$spk};
}
$spoofSession = { %$spoofSession, %$realSession };
# Main session # Main session
$self->p->updateSession( $req, $spoofSession ); $self->p->updateSession( $req, $spoofSession );
return PE_OK; return PE_OK;
...@@ -131,7 +131,6 @@ sub run { ...@@ -131,7 +131,6 @@ sub run {
sub _userDatas { sub _userDatas {
my ( $self, $req ) = @_; my ( $self, $req ) = @_;
$req->{sessionInfo} = {};
# Search user in database # Search user in database
$req->steps( [ $req->steps( [
......
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