Commit 7d27259e authored by Xavier Guimard's avatar Xavier Guimard

Create a "Same" value for userDB and remove some other

parent 9c3bdd51
......@@ -162,6 +162,6 @@
"securedCookie" : 0,
"sessionDataToRemember" : {},
"timeout" : 72000,
"userDB" : "Demo",
"userDB" : "Same",
"whatToTrace" : "_whatToTrace"
}
......@@ -184,6 +184,6 @@
"securedCookie": 0,
"sessionDataToRemember": {},
"timeout": 72000,
"userDB": "Demo",
"userDB": "Same",
"whatToTrace": "_whatToTrace"
}
\ No newline at end of file
}
......@@ -24,8 +24,8 @@ describe('Lemonldap::NG Manager', function() {
element(by.css('.glyphicon-plus-sign')).click();
element(by.id('a-authChoiceModules')).click();
element(by.id('t-authChoiceModules/n1')).click();
element(by.xpath("//option[@value='BrowserID']")).click();
expect(element(by.id('t-browseridParams')).isDisplayed()).toBeTruthy();
element(by.xpath("//option[@value='LDAP']")).click();
expect(element(by.id('t-ldapParams')).isDisplayed()).toBeTruthy();
});
it('should display auth modules chosen with authMulti', function() {
......@@ -39,4 +39,4 @@ describe('Lemonldap::NG Manager', function() {
expect(element(by.id('t-casParams')).isDisplayed()).toBeTruthy();
});
});
});
\ No newline at end of file
});
......@@ -244,7 +244,7 @@ sub defaultValues {
'trustedProxies' => '',
'twitterAuthnLevel' => 1,
'userControl' => '^[\\w\\.\\-@]+$',
'userDB' => 'Demo',
'userDB' => 'Same',
'useRedirectOnError' => 1,
'useSafeJail' => 1,
'webIDAuthnLevel' => 1,
......
......@@ -227,7 +227,7 @@ m[^(?:(?:\-+\s*BEGIN\s+(?:PUBLIC\s+KEY|CERTIFICATE)\s*\-+\r?\n)?[a-zA-Z0-9/\+\r\
map( { $_->{'k'}; } @{ $_[2]{'select'}; } ) );
return $test
? 1
: ( 0, "Invalid value '$_[0]' for this select" );
: ( 1, "Invalid value '$_[0]' for this select" );
}
},
'subContainer' => {
......@@ -2839,8 +2839,12 @@ qr/^(?:(?:(?:(?:(?:(?:[a-zA-Z0-9][-a-zA-Z0-9]*)?[a-zA-Z0-9])[.])*(?:[a-zA-Z][-a-
'type' => 'pcre'
},
'userDB' => {
'default' => 'Demo',
'default' => 'Same',
'select' => [
{
'k' => 'Same',
'v' => 'Same'
},
{
'k' => 'AD',
'v' => 'Active Directory'
......@@ -2849,58 +2853,14 @@ qr/^(?:(?:(?:(?:(?:(?:[a-zA-Z0-9][-a-zA-Z0-9]*)?[a-zA-Z0-9])[.])*(?:[a-zA-Z][-a-
'k' => 'DBI',
'v' => 'Database (DBI)'
},
{
'k' => 'Choice',
'v' => 'authChoice'
},
{
'k' => 'Demo',
'v' => 'Demonstration'
},
{
'k' => 'Facebook',
'v' => 'Facebook'
},
{
'k' => 'Google',
'v' => 'Google'
},
{
'k' => 'LDAP',
'v' => 'LDAP'
},
{
'k' => 'Multi',
'v' => 'Multiple'
},
{
'k' => 'Null',
'v' => 'None'
},
{
'k' => 'OpenID',
'v' => 'OpenID'
},
{
'k' => 'OpenIDConnect',
'v' => 'OpenID Connect'
},
{
'k' => 'Proxy',
'v' => 'Proxy'
},
{
'k' => 'Remote',
'v' => 'Remote'
},
{
'k' => 'SAML',
'v' => 'SAML v2'
},
{
'k' => 'Slave',
'v' => 'Slave'
},
{
'k' => 'WebID',
'v' => 'WebID'
......
......@@ -120,7 +120,7 @@ sub types {
{ $_ eq $_[0] } map ( { $_->{k} } @{ $_[2]->{select} } ) );
return $test
? 1
: ( 0, "Invalid value '$_[0]' for this select" );
: ( 1, "Invalid value '$_[0]' for this select" );
},
},
......@@ -1796,24 +1796,14 @@ sub attributes {
userDB => {
type => 'select',
select => [
{ k => 'AD', v => 'Active Directory' },
{ k => 'DBI', v => 'Database (DBI)' },
{ k => 'Choice', v => 'authChoice' },
{ k => 'Demo', v => 'Demonstration' },
{ k => 'Facebook', v => 'Facebook' },
{ k => 'Google', v => 'Google' },
{ k => 'LDAP', v => 'LDAP' },
{ k => 'Multi', v => 'Multiple' },
{ k => 'Null', v => 'None' },
{ k => 'OpenID', v => 'OpenID' },
{ k => 'OpenIDConnect', v => 'OpenID Connect' },
{ k => 'Proxy', v => 'Proxy' },
{ k => 'Remote', v => 'Remote' },
{ k => 'SAML', v => 'SAML v2' },
{ k => 'Slave', v => 'Slave' },
{ k => 'WebID', v => 'WebID' },
{ k => 'Same', v => 'Same' },
{ k => 'AD', v => 'Active Directory' },
{ k => 'DBI', v => 'Database (DBI)' },
{ k => 'LDAP', v => 'LDAP' },
{ k => 'Null', v => 'None' },
{ k => 'WebID', v => 'WebID' },
],
default => 'Demo',
default => 'Same',
documentation => 'User module',
},
passwordDB => {
......
......@@ -9,7 +9,7 @@ sub zeroConf {
return {
'timeout' => 72000,
'loginHistoryEnabled' => 1,
'userDB' => 'Demo',
'userDB' => 'Same',
'applicationList' => {
'2administration' => {
'manager' => {
......
......@@ -147,6 +147,6 @@
"securedCookie": 0,
"sessionDataToRemember": {},
"timeout": 72000,
"userDB": "Demo",
"userDB": "Same",
"whatToTrace": "_whatToTrace"
}
......@@ -239,53 +239,23 @@
"title": "authentication",
"type": "select"
}, {
"default": "Demo",
"default": "Same",
"id": "userDB",
"select": [{
"k": "Same",
"v": "Same as auth"
}, {
"k": "AD",
"v": "Active Directory"
}, {
"k": "DBI",
"v": "Database (DBI)"
}, {
"k": "Choice",
"v": "authChoice"
}, {
"k": "Demo",
"v": "Demonstration"
}, {
"k": "Facebook",
"v": "Facebook"
}, {
"k": "Google",
"v": "Google"
}, {
"k": "LDAP",
"v": "LDAP"
}, {
"k": "Multi",
"v": "Multiple"
}, {
"k": "Null",
"v": "None"
}, {
"k": "OpenID",
"v": "OpenID"
}, {
"k": "Proxy",
"v": "Proxy"
}, {
"k": "Remote",
"v": "Remote"
}, {
"k": "SAML",
"v": "SAML v2"
}, {
"k": "Slave",
"v": "Slave"
}, {
"k": "WebID",
"v": "WebID"
}],
"title": "userDB",
"type": "select"
......
......@@ -351,57 +351,27 @@
"type": "select",
"data": "Demo"
}, {
"default": "Demo",
"default": "Same",
"id": "userDB",
"select": [{
"k": "Same",
"v": "Same as auth"
}, {
"k": "AD",
"v": "Active Directory"
}, {
"k": "DBI",
"v": "Database (DBI)"
}, {
"k": "Choice",
"v": "authChoice"
}, {
"k": "Demo",
"v": "Demonstration"
}, {
"k": "Facebook",
"v": "Facebook"
}, {
"k": "Google",
"v": "Google"
}, {
"k": "LDAP",
"v": "LDAP"
}, {
"k": "Multi",
"v": "Multiple"
}, {
"k": "Null",
"v": "None"
}, {
"k": "OpenID",
"v": "OpenID"
}, {
"k": "Proxy",
"v": "Proxy"
}, {
"k": "Remote",
"v": "Remote"
}, {
"k": "SAML",
"v": "SAML v2"
}, {
"k": "Slave",
"v": "Slave"
}, {
"k": "WebID",
"v": "WebID"
}],
"title": "userDB",
"type": "select",
"data": "Demo"
"data": "Same"
}, {
"default": "Demo",
"id": "passwordDB",
......
......@@ -361,53 +361,23 @@
"type": "select",
"data": "Demo"
}, {
"default": "Demo",
"default": "Same",
"id": "userDB",
"select": [{
"k": "Same",
"v": "Same as auth"
}, {
"k": "AD",
"v": "Active Directory"
}, {
"k": "DBI",
"v": "Database (DBI)"
}, {
"k": "Choice",
"v": "authChoice"
}, {
"k": "Demo",
"v": "Demonstration"
}, {
"k": "Facebook",
"v": "Facebook"
}, {
"k": "Google",
"v": "Google"
}, {
"k": "LDAP",
"v": "LDAP"
}, {
"k": "Multi",
"v": "Multiple"
}, {
"k": "Null",
"v": "None"
}, {
"k": "OpenID",
"v": "OpenID"
}, {
"k": "Proxy",
"v": "Proxy"
}, {
"k": "Remote",
"v": "Remote"
}, {
"k": "SAML",
"v": "SAML v2"
}, {
"k": "Slave",
"v": "Slave"
}, {
"k": "WebID",
"v": "WebID"
}],
"title": "userDB",
"type": "select",
......
......@@ -351,57 +351,27 @@
"type": "select",
"data": "Demo"
}, {
"default": "Demo",
"default": "Same",
"id": "userDB",
"select": [{
"k": "Same",
"v": "Same as auth"
}, {
"k": "AD",
"v": "Active Directory"
}, {
"k": "DBI",
"v": "Database (DBI)"
}, {
"k": "Choice",
"v": "authChoice"
}, {
"k": "Demo",
"v": "Demonstration"
}, {
"k": "Facebook",
"v": "Facebook"
}, {
"k": "Google",
"v": "Google"
}, {
"k": "LDAP",
"v": "LDAP"
}, {
"k": "Multi",
"v": "Multiple"
}, {
"k": "Null",
"v": "None"
}, {
"k": "OpenID",
"v": "OpenID"
}, {
"k": "Proxy",
"v": "Proxy"
}, {
"k": "Remote",
"v": "Remote"
}, {
"k": "SAML",
"v": "SAML v2"
}, {
"k": "Slave",
"v": "Slave"
}, {
"k": "WebID",
"v": "WebID"
}],
"title": "userDB",
"type": "select",
"data": "Demo"
"data": "Same"
}, {
"default": "Demo",
"id": "passwordDB",
......
......@@ -177,12 +177,14 @@ sub reloadConf {
# Load authentication/userDB
# --------------------------
my $mod;
for my $type (qw(authentication userDB)) {
unless ( $self->conf->{$type} ) {
$self->error("$type is not set");
return $self->fail;
}
my $module = '::' . ucfirst($type) . '::' . $self->conf->{$type};
$mod = $self->conf->{$type} unless($self->conf->{$type} eq 'Same');
my $module = '::' . ucfirst($type) . '::' . $mod;
$module =~ s/Authentication/Auth/;
# Launch and initialize module
......
......@@ -23,7 +23,7 @@ SKIP: {
logLevel => 'error',
useSafeJail => 1,
authentication => 'DBI',
userDB => 'DBI',
userDB => 'Same',
dbiAuthChain => 'dbi:SQLite:dbname=t/userdb.db',
dbiAuthUser => '',
dbiAuthPassword => '',
......
......@@ -16,7 +16,7 @@ SKIP: {
useSafeJail => 1,
authentication => 'LDAP',
portal => 'http://auth.example.com/',
userDB => 'LDAP',
userDB => 'Same',
registerDB => 'LDAP',
LDAPFilter => $ENV{LDAPFILTER} || '(cn=$user)',
ldapServer => $ENV{LDAPSERVER},
......
......@@ -16,7 +16,7 @@ SKIP: {
logLevel => 'error',
useSafeJail => 1,
authentication => 'AD',
userDB => 'AD',
userDB => 'Same',
LDAPFilter => $ENV{ADFILTER} || '(cn=$user)',
ldapServer => $ENV{ADSERVER},
ldapBase => $ENV{ADBASE},
......
......@@ -11,7 +11,7 @@ my $client = LLNG::Manager::Test->new(
logLevel => 'error',
useSafeJail => 1,
authentication => 'Null',
userDB => 'Null',
userDB => 'Same',
}
}
);
......
......@@ -11,7 +11,7 @@ my $client = LLNG::Manager::Test->new(
logLevel => 'error',
useSafeJail => 1,
authentication => 'Slave',
userDB => 'Slave',
userDB => 'Same',
slaveUserHeader => 'My-Test',
slaveExportedVars => {
name => 'Name',
......
......@@ -11,7 +11,7 @@ my $client = LLNG::Manager::Test->new(
logLevel => 'error',
useSafeJail => 1,
authentication => 'Remote',
userDB => 'Remote',
userDB => 'Same',
remoteUserField => 'uid',
remoteGlobalStorage => 'Apache::Session::File',
remoteGlobalStorageOptions => {
......
......@@ -14,7 +14,7 @@ SKIP: {
logLevel => 'error',
useSafeJail => 1,
authentication => 'Proxy',
userDB => 'Proxy',
userDB => 'Same',
soapAuthService => $ENV{REMOTELLNG},
}
}
......
......@@ -27,7 +27,7 @@ SKIP: {
logLevel => 'error',
useSafeJail => 1,
authentication => 'Choice',
userDB => 'Choice',
userDB => 'Same',
authChoiceParam => 'test',
authChoiceModules => {
......
......@@ -182,7 +182,7 @@ sub issuer {
domain => 'idp.com',
portal => 'http://auth.idp.com',
authentication => 'Demo',
userDB => 'Demo',
userDB => 'Same',
issuerDBSAMLActivation => 1,
samlSPMetaDataOptions => {
'sp.com' => {
......@@ -468,7 +468,7 @@ sub sp {
domain => 'sp.com',
portal => 'http://auth.sp.com',
authentication => 'SAML',
userDB => 'SAML',
userDB => 'Same',
issuerDBSAMLActivation => 0,
samlIDPMetaDataExportedAttributes => {
idp => {
......
......@@ -231,7 +231,7 @@ sub issuer {
domain => 'idp.com',
portal => 'http://auth.idp.com',
authentication => 'Demo',
userDB => 'Demo',
userDB => 'Same',
issuerDBSAMLActivation => 1,
samlSPMetaDataOptions => {
'sp.com' => {
......@@ -516,7 +516,7 @@ sub sp {
domain => 'sp.com',
portal => 'http://auth.sp.com',
authentication => 'SAML',
userDB => 'SAML',
userDB => 'Same',
issuerDBSAMLActivation => 0,
samlIDPMetaDataExportedAttributes => {
idp => {
......
......@@ -40,7 +40,7 @@ sub issuer {
domain => 'idp.com',
portal => 'http://auth.idp.com',
authentication => 'Demo',
userDB => 'Demo',
userDB => 'Same',
issuerDBSAMLActivation => 1,
samlSPMetaDataOptions => {
'sp.com' => {
......
......@@ -208,7 +208,7 @@ sub issuer {
domain => 'idp.com',
portal => 'http://auth.idp.com',
authentication => 'Demo',
userDB => 'Demo',
userDB => 'Same',
issuerDBSAMLActivation => 1,
samlSPMetaDataOptions => {
'sp.com' => {
......@@ -496,7 +496,7 @@ sub sp {
domain => 'sp.com',
portal => 'http://auth.sp.com',
authentication => 'SAML',
userDB => 'SAML',
userDB => 'Same',
issuerDBSAMLActivation => 0,
samlIDPMetaDataExportedAttributes => {
idp => {
......
......@@ -225,7 +225,7 @@ sub issuer {
domain => 'idp.com',
portal => 'http://auth.idp.com',
authentication => 'Demo',
userDB => 'Demo',
userDB => 'Same',
issuerDBSAMLActivation => 1,
samlSPMetaDataOptions => {
'sp.com' => {
......@@ -512,7 +512,7 @@ sub sp {
domain => 'sp.com',
portal => 'http://auth.sp.com',
authentication => 'SAML',
userDB => 'SAML',
userDB => 'Same',
issuerDBSAMLActivation => 0,
samlIDPMetaDataExportedAttributes => {
idp => {
......
......@@ -188,7 +188,7 @@ sub issuer {
domain => 'idp.com',
portal => 'http://auth.idp.com',
authentication => 'Demo',
userDB => 'Demo',
userDB => 'Same',
issuerDBSAMLActivation => 1,
samlSPMetaDataOptions => {
'sp.com' => {
......@@ -479,7 +479,7 @@ sub sp {
domain => 'sp.com',
portal => 'http://auth.sp.com',
authentication => 'SAML',
userDB => 'SAML',
userDB => 'Same',
issuerDBSAMLActivation => 0,
samlIDPMetaDataExportedAttributes => {
idp => {
......
......@@ -239,7 +239,7 @@ sub issuer {
domain => 'idp.com',
portal => 'http://auth.idp.com',
authentication => 'Demo',
userDB => 'Demo',
userDB => 'Same',
issuerDBSAMLActivation => 1,
samlSPMetaDataOptions => {
'sp.com' => {
......@@ -529,7 +529,7 @@ sub sp {
domain => 'sp.com',
portal => 'http://auth.sp.com',
authentication => 'SAML',
userDB => 'SAML',
userDB => 'Same',
issuerDBSAMLActivation => 0,
samlIDPMetaDataExportedAttributes => {
idp => {
......
......@@ -182,7 +182,7 @@ sub issuer {
domain => 'idp.com',
portal => 'http://auth.idp.com',
authentication => 'Demo',
userDB => 'Demo',
userDB => 'Same',
issuerDBCASActivation => 1,
casAttr => 'uid',
casAttributes => { cn => 'cn', uid => 'uid', },
......
......@@ -254,7 +254,7 @@ sub op {
domain => 'idp.com',
portal => 'http://auth.op.com',
authentication => 'Demo',
userDB => 'Demo',
userDB => 'Same',
issuerDBOpenIDConnectActivation => "1",
oidcRPMetaDataExportedVars => {
rp => {
......@@ -350,7 +350,7 @@ sub rp {
domain => 'rp.com',
portal => 'http://auth.rp.com',
authentication => 'OpenIDConnect',
userDB => 'OpenIDConnect',
userDB => 'Same',
oidcOPMetaDataExportedVars => {
op => {
cn => "name",
......