Commit 30b34d57 authored by Xavier Guimard's avatar Xavier Guimard

LEMONLDAP::NG : Sessions timeout can now be managed by the manager

parent 85e7acad
......@@ -221,6 +221,9 @@ sub buildTree {
$generalParameters->{cookieName} =
$self->xmlField( "value", $config->{cookieName} || 'lemonldap',
&txt_cookieName, );
$generalParameters->{timeout} =
$self->xmlField( "value", $config->{timeout} || 7200,
&txt_sessionTimeout, );
$sessionStorage->{globalStorage} =
$self->xmlField( "value",
......@@ -395,6 +398,7 @@ sub tree2conf {
}
# General parameters
$config->{cookieName} = $tree->{generalParameters}->{cookieName}->{value};
$config->{timeout} = $tree->{generalParameters}->{timeout}->{value};
$config->{whatToTrace} = $tree->{generalParameters}->{whatToTrace}->{value};
$config->{domain} = $tree->{generalParameters}->{domain}->{value};
$config->{globalStorage} = $tree->{generalParameters}->{sessionStorage}->{globalStorage}->{value};
......@@ -439,6 +443,11 @@ sub checkConf {
$result = 0;
$response->error( '"' . $config->{cookieName} . '" ' . &txt_isNotAValidCookieName );
}
# Check session timeout
unless ( $config->{timeout} =~ /^\d+$/ ) {
$result = 0;
$response->error( '"' . $config->{timeout} . '" ' . &txt_isNotANumber );
}
# Check domain name
unless ( $config->{domain} =~ /^(?=^.{1,254}$)\.?(?:(?!\d+\.)[\w\-]{1,63}\.?)+(?:[a-zA-Z]{2,})$/ ) {
$result = 0;
......
......@@ -18,7 +18,7 @@ sub import {
}
}
$l ||= "en";
foreach $h (qw(authParams cookieName domain groups ldap macros storage vars
foreach $h (qw(authParams cookieName domain groups ldap macros storage timeout vars
whatToTrace virtualHosts)) {
*{"${caller_package}::help_$h"} = \&{"help_${h}_$l"};
}
......@@ -395,6 +395,22 @@ module&nbsp;:</p>
EOT
}
sub help_timeout_en {
print <<EOT;
<h3>Sessions timeout</h3>
<p> Set here the sessions timeout in minutes. It will be used by the
purgeCentralStorage script given in the source tree.
EOT
}
sub help_timeout_fr {
print <<EOT;
<h3>Dur&eacute;e de vie des sessions</h3>
<p> Indiquez ici la dur&eacute;e de vie des sessions en minutes. Elle est
utilis&eacute;e par le script purgeCentralStorage fourni dans les sources.
EOT
}
sub help_vars_en {
print <<EOT;
<h3>Variables (LDAP attributes)</h3>
......
......@@ -195,6 +195,9 @@ function onNodeSelect(nodeId) {
else if(nodeIs(nodeId,'cookieName')){
help('cookieName');
}
else if(nodeIs(nodeId,'timeout')){
help('timeout');
}
else if(nodeIs(nodeId,'domain')){
help('domain');
}
......
......@@ -65,6 +65,7 @@ sub en {
invalidLine => "Invalid Line",
invalidVirtualHostName => "Invalid virtual host name",
invalidWhatToTrace => "Data to use in Apache's logs can contain only an exported attribute or a macro",
isNotANumber => "is not a number",
isNotAValidAttributeName => "is not a valid attribute name",
isNotAValidCookieName => "is not a valid cookie name",
isNotAValidDomainName => "is not a valid domain name",
......@@ -99,6 +100,7 @@ sub en {
saveFailure => "Save failure",
securedCookie => "Secured Cookie (SSL)",
sessionStorage => "Session Storage",
sessionTimeout => "Session timeout",
syntaxError => "Syntax error",
unableToSave => "Your browser does not support XMLHTTPRequest objects: fail to save.",
unknownError => "Unknown error",
......@@ -144,6 +146,7 @@ sub fr {
invalidLine => "Ligne invalide",
invalidVirtualHostName => "Nom de d'hte virtuel incorrect",
invalidWhatToTrace => "La donn&eacute;e &agrave; inscrire dans les journaux ne peut contenir qu'un attribut export ou une macro",
isNotANumber => "n'est pas un nombre",
isNotAValidAttributeName => "n'est pas un nom d'attribut valide",
isNotAValidCookieName => "n'est pas un nom de cookie valide",
isNotAValidDomainName => "n'est pas un nom de domaine valide",
......@@ -178,6 +181,7 @@ sub fr {
saveFailure => "&Eacute;chec de la sauvegarde",
securedCookie => "Cookie s&eacute;curis&eacute; (SSL)",
sessionStorage => "Stockage des sessions",
sessionTimeout => "Dure de vie des sessions",
syntaxError => "Erreur de syntaxe",
unableToSave => "Votre navigateur ne supporte pas les objets XMLHTTPRequest: sauvegarde impossible.",
unknownError => "Erreur inconnue",
......
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