Commit 10177b4b authored by Xavier Guimard's avatar Xavier Guimard

Default storage values (may fix #1305)

parent 6e7510c9
......@@ -311,8 +311,15 @@ sub extractFormInfo {
# Restore initial SAML request in case of proxying
if ($assertion_responded) {
my $moduleOptions = $self->conf->{samlStorageOptions} || {};
$moduleOptions->{backend} = $self->conf->{samlStorage};
my $moduleOptions;
if ( $self->conf->{samlStorage} ) {
$moduleOptions = $self->conf->{samlStorageOptions} || {};
$moduleOptions->{backend} = $self->conf->{samlStorage};
}
else {
$moduleOptions = $self->conf->{globalStorageOptions} || {};
$moduleOptions->{backend} = $self->conf->{globalStorage};
}
my $module = "Lemonldap::NG::Common::Apache::Session";
my $saml_sessions =
......@@ -554,8 +561,15 @@ sub extractFormInfo {
$self->logger->debug("Logout request NameID content: $user");
# Get SAML sessions with the same NameID
my $moduleOptions = $self->conf->{samlStorageOptions} || {};
$moduleOptions->{backend} = $self->conf->{samlStorage};
my $moduleOptions;
if ( $self->conf->{samlStorage} ) {
$moduleOptions = $self->conf->{samlStorageOptions} || {};
$moduleOptions->{backend} = $self->conf->{samlStorage};
}
else {
$moduleOptions = $self->conf->{globalStorageOptions} || {};
$moduleOptions->{backend} = $self->conf->{globalStorage};
}
my $module = "Lemonldap::NG::Common::Apache::Session";
my $local_sessions =
......
......@@ -1634,8 +1634,15 @@ sub attributeServer {
# Get sessionInfo for the given NameID
my $sessionInfo;
my $moduleOptions = $self->conf->{samlStorageOptions} || {};
$moduleOptions->{backend} = $self->conf->{samlStorage};
my $moduleOptions;
if ( $self->conf->{samlStorage} ) {
$moduleOptions = $self->conf->{samlStorageOptions} || {};
$moduleOptions->{backend} = $self->conf->{samlStorage};
}
else {
$moduleOptions = $self->conf->{globalStorageOptions} || {};
$moduleOptions->{backend} = $self->conf->{globalStorage};
}
my $module = "Lemonldap::NG::Common::Apache::Session";
my $saml_sessions =
......
......@@ -240,8 +240,15 @@ sub deleteCasSecondarySessions {
my $result = 1;
# Find CAS sessions
my $moduleOptions = $self->conf->{casStorageOptions} || {};
$moduleOptions->{backend} = $self->conf->{casStorage};
my $moduleOptions;
if ( $self->conf->{casStorage} ) {
$moduleOptions = $self->conf->{casStorageOptions} || {};
$moduleOptions->{backend} = $self->conf->{casStorage};
}
else {
$moduleOptions = $self->conf->{globalStorageOptions} || {};
$moduleOptions->{backend} = $self->conf->{globalStorage};
}
my $module = "Lemonldap::NG::Common::Apache::Session";
my $cas_sessions =
......@@ -379,8 +386,15 @@ sub validateST {
$xml->{'cas:authenticationSuccess'}->{'cas:proxyGrantingTicket'};
if ($pgtIou) {
my $moduleOptions = $self->conf->{casStorageOptions} || {};
$moduleOptions->{backend} = $self->conf->{casStorage};
my $moduleOptions;
if ( $self->conf->{casStorage} ) {
$moduleOptions = $self->conf->{casStorageOptions} || {};
$moduleOptions->{backend} = $self->conf->{casStorage};
}
else {
$moduleOptions = $self->conf->{globalStorageOptions} || {};
$moduleOptions->{backend} = $self->conf->{globalStorage};
}
my $module = "Lemonldap::NG::Common::Apache::Session";
my $pgtIdSessions =
......
......@@ -1633,8 +1633,15 @@ sub replayProtection {
return 0;
}
my $moduleOptions = $self->conf->{samlStorageOptions} || {};
$moduleOptions->{backend} = $self->conf->{samlStorage};
my $moduleOptions;
if ( $self->conf->{samlStorage} ) {
$moduleOptions = $self->conf->{samlStorageOptions} || {};
$moduleOptions->{backend} = $self->conf->{samlStorage};
}
else {
$moduleOptions = $self->conf->{globalStorageOptions} || {};
$moduleOptions->{backend} = $self->conf->{globalStorage};
}
my $module = "Lemonldap::NG::Common::Apache::Session";
my $sessions = $module->searchOn( $moduleOptions, "_assert_id", $samlID );
......@@ -1759,8 +1766,15 @@ sub loadArtifact {
return;
}
my $moduleOptions = $self->conf->{samlStorageOptions} || {};
$moduleOptions->{backend} = $self->conf->{samlStorage};
my $moduleOptions;
if ( $self->conf->{samlStorage} ) {
$moduleOptions = $self->conf->{samlStorageOptions} || {};
$moduleOptions->{backend} = $self->conf->{samlStorage};
}
else {
$moduleOptions = $self->conf->{globalStorageOptions} || {};
$moduleOptions->{backend} = $self->conf->{globalStorage};
}
my $module = "Lemonldap::NG::Common::Apache::Session";
my $sessions = $module->searchOn( $moduleOptions, "_art_id", $id );
......@@ -2932,8 +2946,15 @@ sub deleteSAMLSecondarySessions {
my $result = 1;
# Find SAML sessions
my $moduleOptions = $self->conf->{samlStorageOptions} || {};
$moduleOptions->{backend} = $self->conf->{samlStorage};
my $moduleOptions;
if ( $self->conf->{samlStorage} ) {
$moduleOptions = $self->conf->{samlStorageOptions} || {};
$moduleOptions->{backend} = $self->conf->{samlStorage};
}
else {
$moduleOptions = $self->conf->{globalStorageOptions} || {};
$moduleOptions->{backend} = $self->conf->{globalStorage};
}
my $module = "Lemonldap::NG::Common::Apache::Session";
my $saml_sessions =
......
......@@ -55,15 +55,17 @@ sub status {
%{ $self->conf->{"${type}StorageOptions"} },
backend => $self->conf->{"${type}Storage"}
);
my $sessions = Lemonldap::NG::Common::Apache::Session->searchOn(
\%modOpts,
_session_kind => 'SSO',
'_session_id'
);
if (%$sessions) {
my @s = keys %$sessions;
$res->{storage}->{$type} = @s;
}
eval {
my $sessions = Lemonldap::NG::Common::Apache::Session->searchOn(
\%modOpts,
_session_kind => 'SSO',
'_session_id'
);
if (%$sessions) {
my @s = keys %$sessions;
$res->{storage}->{$type} = @s;
}
};
}
}
return $self->p->sendJSONresponse( $req, $res );
......
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