Set some default values in Attributes.pm (#595)

This commit is contained in:
Xavier Guimard 2018-04-30 18:06:15 +02:00
parent 8fe6a90b1a
commit c673be7cf2
7 changed files with 46 additions and 22 deletions

View File

@ -244,6 +244,8 @@ sub defaultValues {
'SMTPServer' => '',
'SMTPTLS' => '',
'SSLAuthnLevel' => 5,
'SSLVar' => 'SSL_CLIENT_S_DN_Email',
'SSLVarIf' => {},
'successLoginNumber' => 5,
'timeout' => 72000,
'timeoutActivity' => 0,

View File

@ -3004,19 +3004,19 @@ qr/(?:(?:https?):\/\/(?:(?:(?:(?:(?:(?:[a-zA-Z0-9][-a-zA-Z0-9]*)?[a-zA-Z0-9])[.]
'default' => 0,
'select' => [
{
'k' => 0,
'k' => '0',
'v' => 'unsecuredCookie'
},
{
'k' => 1,
'k' => '1',
'v' => 'securedCookie'
},
{
'k' => 2,
'k' => '2',
'v' => 'doubleCookie'
},
{
'k' => 3,
'k' => '3',
'v' => 'doubleCookieForSingleSession'
}
],
@ -3146,10 +3146,12 @@ qr/^(?:(?:(?:(?:(?:(?:[a-zA-Z0-9][-a-zA-Z0-9]*)?[a-zA-Z0-9])[.])*(?:[a-zA-Z][-a-
'type' => 'url'
},
'SSLVar' => {
'type' => 'text'
'default' => 'SSL_CLIENT_S_DN_Email',
'type' => 'text'
},
'SSLVarIf' => {
'type' => 'keyTextContainer'
'default' => {},
'type' => 'keyTextContainer'
},
'staticPrefix' => {
'type' => 'text'

View File

@ -1054,7 +1054,7 @@ sub attributes {
default => 1,
documentation => 'Upgrade session activation',
},
# 2F
max2FDevices => {
default => 10,
@ -1066,7 +1066,7 @@ sub attributes {
type => 'int',
documentation => 'Maximum 2F devices name length',
},
# U2F
u2fActivation => {
type => 'boolOrExpr',
@ -2401,8 +2401,14 @@ m{^(?:ldapi://[^/]*/?|\w[\w\-\.]*(?::\d{1,5})?|ldap(?:s|\+tls)?://\w[\w\-\.]*(?:
default => 5,
documentation => 'SSL authentication level',
},
SSLVar => { type => 'text', },
SSLVarIf => { type => 'keyTextContainer', },
SSLVar => {
type => 'text',
default => 'SSL_CLIENT_S_DN_Email'
},
SSLVarIf => {
type => 'keyTextContainer',
default => {}
},
sslByAjax => {
type => 'bool',
documentation => 'Use Ajax request for SSL',

File diff suppressed because one or more lines are too long

View File

@ -13,16 +13,9 @@ our $VERSION = '2.0.0';
extends 'Lemonldap::NG::Portal::Main::Auth';
# PROPERTIES
has SSLField => ( is => 'rw' );
# INITIALIZATION
sub init {
my ($self) = @_;
$self->SSLField( $self->conf->{SSLVar} ||= 'SSL_CLIENT_S_DN_Email' );
$self->conf->{SSLVarIf} ||= {};
return 1;
}
@ -30,7 +23,7 @@ sub init {
# @return Lemonldap::NG::Portal constant
sub extractFormInfo {
my ( $self, $req ) = @_;
my $field = $self->SSLField;
my $field = $self->conf->{SSLVar};
if ( $req->env->{SSL_CLIENT_I_DN}
and my $tmp =
$self->conf->{SSLVarIf}->{ $req->env->{SSL_CLIENT_I_DN} } )

View File

@ -74,7 +74,6 @@ sub new {
weaken $self->{portal};
# Setting default LDAP password storage encoding to utf-8
$self->{conf}->{ldapPwdEnc} ||= 'utf-8';
return $self;
}

View File

@ -23,9 +23,31 @@ ok(
),
'Auth query'
);
count(1);
expectOK($res);
my $id = expectCookie($res);
expectCookie($res);
count(1);
$client = LLNG::Manager::Test->new(
{
ini => {
logLevel => 'error',
useSafeJail => 1,
authentication => 'SSL',
userDB => 'Null',
}
}
);
ok(
$res = $client->_get(
'/', custom => { SSL_CLIENT_S_DN_Email => 'dwho' }
),
'Auth query'
);
expectOK($res);
expectCookie($res);
count(1);
clean_sessions();
done_testing( count() );