Set some default values in Attributes.pm (#595)
This commit is contained in:
parent
8fe6a90b1a
commit
c673be7cf2
|
@ -244,6 +244,8 @@ sub defaultValues {
|
|||
'SMTPServer' => '',
|
||||
'SMTPTLS' => '',
|
||||
'SSLAuthnLevel' => 5,
|
||||
'SSLVar' => 'SSL_CLIENT_S_DN_Email',
|
||||
'SSLVarIf' => {},
|
||||
'successLoginNumber' => 5,
|
||||
'timeout' => 72000,
|
||||
'timeoutActivity' => 0,
|
||||
|
|
|
@ -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,9 +3146,11 @@ qr/^(?:(?:(?:(?:(?:(?:[a-zA-Z0-9][-a-zA-Z0-9]*)?[a-zA-Z0-9])[.])*(?:[a-zA-Z][-a-
|
|||
'type' => 'url'
|
||||
},
|
||||
'SSLVar' => {
|
||||
'default' => 'SSL_CLIENT_S_DN_Email',
|
||||
'type' => 'text'
|
||||
},
|
||||
'SSLVarIf' => {
|
||||
'default' => {},
|
||||
'type' => 'keyTextContainer'
|
||||
},
|
||||
'staticPrefix' => {
|
||||
|
|
|
@ -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
|
@ -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} } )
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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() );
|
||||
|
|
Loading…
Reference in New Issue
Block a user