Commit 832f7050 authored by Clément OUDOT's avatar Clément OUDOT

Add activation parameter for each IssuerDB module (#147)

parent 373c4a31
......@@ -323,17 +323,33 @@ sub struct {
# IssuerDB branch
issuerDB => {
_nodes => [qw(issuerDBSAML issuerDBCAS)],
_nodes => [qw(issuerDBSAML issuerDBCAS issuerDBOpenID)],
issuerDBSAML => {
_nodes => [qw(issuerDBSAMLPath issuerDBSAMLRule)],
_nodes => [
qw(issuerDBSAMLActivation issuerDBSAMLPath issuerDBSAMLRule)
],
issuerDBSAMLActivation =>
'bool:/issuerDBSAMLActivation',
issuerDBSAMLPath => 'text:/issuerDBSAMLPath',
issuerDBSAMLRule => 'text:/issuerDBSAMLRule',
},
issuerDBCAS => {
_nodes => [qw(issuerDBCASPath issuerDBCASRule)],
_nodes => [
qw(issuerDBCASActivation issuerDBCASPath issuerDBCASRule)
],
issuerDBCASActivation => 'bool:/issuerDBCASActivation',
issuerDBCASPath => 'text:/issuerDBCASPath',
issuerDBCASRule => 'text:/issuerDBCASRule',
},
issuerDBOpenID => {
_nodes => [
qw(issuerDBOpenIDActivation issuerDBOpenIDPath issuerDBOpenIDRule)
],
issuerDBOpenIDActivation =>
'bool:/issuerDBOpenIDActivation',
issuerDBOpenIDPath => 'text:/issuerDBOpenIDPath',
issuerDBOpenIDRule => 'text:/issuerDBOpenIDRule',
},
},
# LDAP
......@@ -1031,6 +1047,7 @@ sub testStruct {
},
},
https => $boolean,
issuerDBSAMLActivation => $boolean,
issuerDBSAMLPath => $testNotDefined,
issuerDBSAMLRule => {
test => $perlExpr,
......@@ -1040,6 +1057,7 @@ sub testStruct {
1;
},
},
issuerDBCASActivation => $boolean,
issuerDBCASPath => $testNotDefined,
issuerDBCASRule => {
test => $perlExpr,
......@@ -1049,6 +1067,16 @@ sub testStruct {
1;
},
},
issuerDBOpenIDActivation => $boolean,
issuerDBOpenIDPath => $testNotDefined,
issuerDBOpenIDRule => {
test => $perlExpr,
warnTest => sub {
my $e = shift;
return ( 0, $assignMsg ) if ( $e =~ $assignTest );
1;
},
},
ldapBase => {
test => qr/^(?:\w+=.*|)$/,
msgFail => 'Bad LDAP base',
......@@ -1387,10 +1415,15 @@ sub defaultConf {
domain => 'example.com',
globalStorage => 'Apache::Session::File',
https => '0',
issuerDBSAMLActivation => '0',
issuerDBSAMLPath => '^/saml/',
issuerDBSAMLRule => '0',
issuerDBSAMLRule => '1',
issuerDBCASActivation => '0',
issuerDBCASPath => '^/cas/',
issuerDBCASRule => '0',
issuerDBCASRule => '1',
issuerDBOpenIDActivation => '0',
issuerDBOpenIDPath => '^/cas/',
issuerDBOpenIDRule => '1',
ldapBase => 'dc=example,dc=com',
ldapPort => '389',
ldapPwdEnc => 'utf-8',
......
......@@ -100,11 +100,17 @@ sub en {
https => 'Default value for https parameter',
issuerDB => 'Issuer module',
issuerDBSAML => 'SAML',
issuerDBSAMLActivation => 'Activation',
issuerDBSAMLPath => 'Path',
issuerDBSAMLRule => 'Activation rule',
issuerDBSAMLRule => 'Use rule',
issuerDBCAS => 'CAS',
issuerDBCASActivation => 'Activation',
issuerDBCASPath => 'Path',
issuerDBCASRule => 'Activation rule',
issuerDBCASRule => 'Use rule',
issuerDBOpenID => 'OpenID',
issuerDBOpenIDActivation => 'Activation',
issuerDBOpenIDPath => 'Path',
issuerDBOpenIDRule => 'Use rule',
ldapBase => 'Users search base',
ldapChangePasswordAsUser => 'Change as user',
ldapConnection => 'Connection',
......@@ -390,11 +396,17 @@ sub fr {
https => 'Valeur par défaut du paramètre https',
issuerDB => 'Module fournisseur',
issuerDBSAML => 'SAML',
issuerDBSAMLActivation => 'Activation',
issuerDBSAMLPath => 'Chemin',
issuerDBSAMLRule => 'Règle d\'activation',
issuerDBSAMLRule => 'Règle d\'utilisation',
issuerDBCAS => 'CAS',
issuerDBCASActivation => 'Activation',
issuerDBCASPath => 'Chemin',
issuerDBCASRule => 'Règle d\'activation',
issuerDBCASRule => 'Règle d\'utilisation',
issuerDBOpenID => 'OpenID',
issuerDBOpenIDActivation => 'Activation',
issuerDBOpenIDPath => 'Chemin',
issuerDBOpenIDRule => 'Règle d\'utilisation',
ldapBase => 'Base de recherche des utilisateurs',
ldapChangePasswordAsUser => 'Changement en tant qu\'utilisateur',
ldapConnection => 'Connexion',
......
......@@ -241,6 +241,18 @@ sub new {
$self->lmLog( "[IssuerDB activation] Try issuerDB module $issuerDBtype",
'debug' );
# Check activation flag
my $activation =
$self->{ "issuerDB" . $issuerDBtype . "Activation" } ||= "0";
unless ($activation) {
$self->lmLog(
"[IssuerDB activation] Activation flag set to off, trying next",
'debug'
);
next;
}
# Check the path
my $path = $self->{ "issuerDB" . $issuerDBtype . "Path" };
if ( defined $path ) {
......
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