Update SAML cache on new configuration (references #400)

This commit is contained in:
Clément Oudot 2011-12-05 14:21:24 +00:00
parent 335e417067
commit 290ec606d8
2 changed files with 21 additions and 3 deletions

View File

@ -14,7 +14,7 @@ use Lemonldap::NG::Common::Conf::Constants; #inherits
*EXPORT_TAGS = *Lemonldap::NG::Portal::Simple::EXPORT_TAGS;
*EXPORT = *Lemonldap::NG::Portal::Simple::EXPORT;
our $VERSION = '1.1.0';
our $VERSION = '1.2.0';
use base qw(Lemonldap::NG::Portal::Simple);
our $confCached;
@ -45,7 +45,10 @@ sub getConf {
my $num = $self->__lmConf->lastCfg;
# Reload configuration
unless ( $confCached and $confCached->{cfgNum} == $num ) {
$self->lmLog( "Cached configuration too old, get configuration $num",
'debug' );
my $gConf = $self->__lmConf->getConf( { cfgNum => $num } );
my $lConf = $self->__lmConf->getLocalConf(PORTALSECTION);
unless ( ref($gConf) and ref($lConf) ) {

View File

@ -19,7 +19,7 @@ use Encode; # Encode attribute values
# Special comments for doxygen
#inherits Lemonldap::NG::Common::Conf::SAML::Metadata protected service_metadata
our $VERSION = '1.0.2';
our $VERSION = '1.2.0';
our $samlCache;
our $initGlibDone;
@ -71,6 +71,20 @@ BEGIN {
# @return boolean result
sub loadLasso {
my $self = shift;
# Reload SAML cache if configuration number has changed
unless ( $samlCache->{cfgNum} == $self->{cfgNum} ) {
$self->lmLog( "Reset SAML configuration cache", 'debug' );
delete $samlCache->{_lassoServerDump};
delete $samlCache->{_spList};
delete $samlCache->{_idpList};
$samlCache->{cfgNum} = $self->{cfgNum};
}
$self->lmLog( "SAML cache configuration: " . $samlCache->{cfgNum},
'debug' );
return 1 if ($initGlibDone);
# Catch GLib Lasso messages (require Glib)
@ -86,7 +100,7 @@ sub loadLasso {
}
unless (LASSO) {
$self->lmLog( "Module Lasso not loaded (see bellow)", 'error' );
$self->lmLog( "Module Lasso not loaded (see below)", 'error' );
return 0;
}
@ -96,6 +110,7 @@ sub loadLasso {
}
$initGlibDone = 1;
return 1;
}