Set some default values in Attributes.pm (#595)
This commit is contained in:
parent
8fe6a90b1a
commit
c673be7cf2
|
@ -244,6 +244,8 @@ sub defaultValues {
|
||||||
'SMTPServer' => '',
|
'SMTPServer' => '',
|
||||||
'SMTPTLS' => '',
|
'SMTPTLS' => '',
|
||||||
'SSLAuthnLevel' => 5,
|
'SSLAuthnLevel' => 5,
|
||||||
|
'SSLVar' => 'SSL_CLIENT_S_DN_Email',
|
||||||
|
'SSLVarIf' => {},
|
||||||
'successLoginNumber' => 5,
|
'successLoginNumber' => 5,
|
||||||
'timeout' => 72000,
|
'timeout' => 72000,
|
||||||
'timeoutActivity' => 0,
|
'timeoutActivity' => 0,
|
||||||
|
|
|
@ -3004,19 +3004,19 @@ qr/(?:(?:https?):\/\/(?:(?:(?:(?:(?:(?:[a-zA-Z0-9][-a-zA-Z0-9]*)?[a-zA-Z0-9])[.]
|
||||||
'default' => 0,
|
'default' => 0,
|
||||||
'select' => [
|
'select' => [
|
||||||
{
|
{
|
||||||
'k' => 0,
|
'k' => '0',
|
||||||
'v' => 'unsecuredCookie'
|
'v' => 'unsecuredCookie'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'k' => 1,
|
'k' => '1',
|
||||||
'v' => 'securedCookie'
|
'v' => 'securedCookie'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'k' => 2,
|
'k' => '2',
|
||||||
'v' => 'doubleCookie'
|
'v' => 'doubleCookie'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'k' => 3,
|
'k' => '3',
|
||||||
'v' => 'doubleCookieForSingleSession'
|
'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'
|
'type' => 'url'
|
||||||
},
|
},
|
||||||
'SSLVar' => {
|
'SSLVar' => {
|
||||||
'type' => 'text'
|
'default' => 'SSL_CLIENT_S_DN_Email',
|
||||||
|
'type' => 'text'
|
||||||
},
|
},
|
||||||
'SSLVarIf' => {
|
'SSLVarIf' => {
|
||||||
'type' => 'keyTextContainer'
|
'default' => {},
|
||||||
|
'type' => 'keyTextContainer'
|
||||||
},
|
},
|
||||||
'staticPrefix' => {
|
'staticPrefix' => {
|
||||||
'type' => 'text'
|
'type' => 'text'
|
||||||
|
|
|
@ -1054,7 +1054,7 @@ sub attributes {
|
||||||
default => 1,
|
default => 1,
|
||||||
documentation => 'Upgrade session activation',
|
documentation => 'Upgrade session activation',
|
||||||
},
|
},
|
||||||
|
|
||||||
# 2F
|
# 2F
|
||||||
max2FDevices => {
|
max2FDevices => {
|
||||||
default => 10,
|
default => 10,
|
||||||
|
@ -1066,7 +1066,7 @@ sub attributes {
|
||||||
type => 'int',
|
type => 'int',
|
||||||
documentation => 'Maximum 2F devices name length',
|
documentation => 'Maximum 2F devices name length',
|
||||||
},
|
},
|
||||||
|
|
||||||
# U2F
|
# U2F
|
||||||
u2fActivation => {
|
u2fActivation => {
|
||||||
type => 'boolOrExpr',
|
type => 'boolOrExpr',
|
||||||
|
@ -2401,8 +2401,14 @@ m{^(?:ldapi://[^/]*/?|\w[\w\-\.]*(?::\d{1,5})?|ldap(?:s|\+tls)?://\w[\w\-\.]*(?:
|
||||||
default => 5,
|
default => 5,
|
||||||
documentation => 'SSL authentication level',
|
documentation => 'SSL authentication level',
|
||||||
},
|
},
|
||||||
SSLVar => { type => 'text', },
|
SSLVar => {
|
||||||
SSLVarIf => { type => 'keyTextContainer', },
|
type => 'text',
|
||||||
|
default => 'SSL_CLIENT_S_DN_Email'
|
||||||
|
},
|
||||||
|
SSLVarIf => {
|
||||||
|
type => 'keyTextContainer',
|
||||||
|
default => {}
|
||||||
|
},
|
||||||
sslByAjax => {
|
sslByAjax => {
|
||||||
type => 'bool',
|
type => 'bool',
|
||||||
documentation => 'Use Ajax request for SSL',
|
documentation => 'Use Ajax request for SSL',
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -13,16 +13,9 @@ our $VERSION = '2.0.0';
|
||||||
|
|
||||||
extends 'Lemonldap::NG::Portal::Main::Auth';
|
extends 'Lemonldap::NG::Portal::Main::Auth';
|
||||||
|
|
||||||
# PROPERTIES
|
|
||||||
|
|
||||||
has SSLField => ( is => 'rw' );
|
|
||||||
|
|
||||||
# INITIALIZATION
|
# INITIALIZATION
|
||||||
|
|
||||||
sub init {
|
sub init {
|
||||||
my ($self) = @_;
|
|
||||||
$self->SSLField( $self->conf->{SSLVar} ||= 'SSL_CLIENT_S_DN_Email' );
|
|
||||||
$self->conf->{SSLVarIf} ||= {};
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,7 +23,7 @@ sub init {
|
||||||
# @return Lemonldap::NG::Portal constant
|
# @return Lemonldap::NG::Portal constant
|
||||||
sub extractFormInfo {
|
sub extractFormInfo {
|
||||||
my ( $self, $req ) = @_;
|
my ( $self, $req ) = @_;
|
||||||
my $field = $self->SSLField;
|
my $field = $self->conf->{SSLVar};
|
||||||
if ( $req->env->{SSL_CLIENT_I_DN}
|
if ( $req->env->{SSL_CLIENT_I_DN}
|
||||||
and my $tmp =
|
and my $tmp =
|
||||||
$self->conf->{SSLVarIf}->{ $req->env->{SSL_CLIENT_I_DN} } )
|
$self->conf->{SSLVarIf}->{ $req->env->{SSL_CLIENT_I_DN} } )
|
||||||
|
|
|
@ -74,7 +74,6 @@ sub new {
|
||||||
weaken $self->{portal};
|
weaken $self->{portal};
|
||||||
|
|
||||||
# Setting default LDAP password storage encoding to utf-8
|
# Setting default LDAP password storage encoding to utf-8
|
||||||
$self->{conf}->{ldapPwdEnc} ||= 'utf-8';
|
|
||||||
return $self;
|
return $self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,9 +23,31 @@ ok(
|
||||||
),
|
),
|
||||||
'Auth query'
|
'Auth query'
|
||||||
);
|
);
|
||||||
count(1);
|
|
||||||
expectOK($res);
|
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();
|
clean_sessions();
|
||||||
|
|
||||||
done_testing( count() );
|
done_testing( count() );
|
||||||
|
|
Loading…
Reference in New Issue
Block a user