Commit deff50f0 authored by Clément OUDOT's avatar Clément OUDOT
Browse files

Fix CDA with session kind restriction (#1756)

parent b63ee346
......@@ -10,7 +10,7 @@ use warnings;
use Exporter 'import';
our $VERSION = '1.9.15';
our $VERSION = '1.9.20';
use warnings;
use MIME::Base64;
......@@ -1061,7 +1061,7 @@ sub updatePersistentSession {
}
## @method void updateSession(hashRef infos, string id)
## @method void updateSession(hashRef infos, string id, string kind)
# Update session stored.
# If no id is given, try to get it from cookie.
# If the session is available, update datas with $info.
......@@ -1069,9 +1069,10 @@ sub updatePersistentSession {
# server local cache, if there are several LL::NG servers.
# @param infos hash reference of information to update
# @param id Session ID
# @param kind Session kind
# @return nothing
sub updateSession {
my ( $self, $infos, $id ) = @_;
my ( $self, $infos, $id, $kind ) = @_;
# Return if no infos to update
return () unless ( ref $infos eq 'HASH' and %$infos );
......@@ -1096,7 +1097,9 @@ sub updateSession {
}
# Update session in global storage
if ( my $apacheSession = $self->getApacheSession( $id, 1 ) ) {
if ( my $apacheSession =
$self->getApacheSession( $id, 1, undef, $kind ) )
{
# Store updateTime
$infos->{updateTime} = strftime( "%Y%m%d%H%M%S", localtime() );
......@@ -1591,8 +1594,8 @@ sub process {
{
if ( ( my $code = $self->{error} ) > 0 ) {
print $self->header(
-status => '401 Unauthorizated',
'-WWW-Authenticate' => "SSO $self->{portal}",
-status => '401 Unauthorizated',
'-WWW-Authenticate' => "SSO $self->{portal}",
);
$self->quit;
}
......@@ -2134,8 +2137,10 @@ sub setSessionInfo {
$self->{sessionInfo}->{_utime} ||= $now;
$self->{sessionInfo}->{startTime} =
strftime( "%Y%m%d%H%M%S", localtime() );
$self->{sessionInfo}->{_lastSeen} = $now if ( $self->{timeoutActivity} );
$self->lmLog( "Update _lastSeen with $now from Portal", 'debug' ) if ( $self->{timeoutActivity} );
$self->{sessionInfo}->{_lastSeen} = $now
if ( $self->{timeoutActivity} );
$self->lmLog( "Update _lastSeen with $now from Portal", 'debug' )
if ( $self->{timeoutActivity} );
}
# Get environment variables matching exportedVars
......@@ -2787,7 +2792,7 @@ sub autoRedirect {
$cdaInfos->{cookie_name} = $self->{cookieName} . "http";
}
$self->updateSession( $cdaInfos, $cdaSession->id );
$self->updateSession( $cdaInfos, $cdaSession->id, "CDA" );
$self->{urldc} .=
( $self->{urldc} =~ /\?/ ? '&' : '?' )
......
Supports Markdown
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