Default values for Portal all managed in Common (#686)
This commit is contained in:
parent
2630d09d72
commit
18b337723d
|
@ -44,6 +44,27 @@ has 'authentication' => (
|
||||||
|
|
||||||
## C
|
## C
|
||||||
|
|
||||||
|
has 'captcha_login_enabled' => (
|
||||||
|
is => 'rw',
|
||||||
|
isa => 'Bool',
|
||||||
|
default => '0',
|
||||||
|
documentation => 'Captcha on login page',
|
||||||
|
);
|
||||||
|
|
||||||
|
has 'captcha_mail_enabled' => (
|
||||||
|
is => 'rw',
|
||||||
|
isa => 'Bool',
|
||||||
|
default => '0',
|
||||||
|
documentation => 'Captcha on password reset page',
|
||||||
|
);
|
||||||
|
|
||||||
|
has 'captcha_size' => (
|
||||||
|
is => 'rw',
|
||||||
|
isa => 'Int',
|
||||||
|
default => '6',
|
||||||
|
documentation => 'Captcha size',
|
||||||
|
);
|
||||||
|
|
||||||
has 'casAccessControlPolicy' => (
|
has 'casAccessControlPolicy' => (
|
||||||
is => 'rw',
|
is => 'rw',
|
||||||
isa => 'Str',
|
isa => 'Str',
|
||||||
|
@ -58,6 +79,13 @@ has 'CAS_authnLevel' => (
|
||||||
documentation => 'CAS authentication level',
|
documentation => 'CAS authentication level',
|
||||||
);
|
);
|
||||||
|
|
||||||
|
has 'checkXSS' => (
|
||||||
|
is => 'rw',
|
||||||
|
isa => 'Bool',
|
||||||
|
default => '1',
|
||||||
|
documentation => 'Check XSS',
|
||||||
|
);
|
||||||
|
|
||||||
has 'confirmFormMethod' => (
|
has 'confirmFormMethod' => (
|
||||||
is => 'rw',
|
is => 'rw',
|
||||||
isa => 'Str',
|
isa => 'Str',
|
||||||
|
@ -99,6 +127,13 @@ has 'facebookAuthnLevel' => (
|
||||||
documentation => 'Facebook authentication level',
|
documentation => 'Facebook authentication level',
|
||||||
);
|
);
|
||||||
|
|
||||||
|
has 'failedLoginNumber' => (
|
||||||
|
is => 'rw',
|
||||||
|
isa => 'Int',
|
||||||
|
default => '5',
|
||||||
|
documentation => 'Number of failures stored in login history',
|
||||||
|
);
|
||||||
|
|
||||||
## G
|
## G
|
||||||
|
|
||||||
has 'globalStorage' => (
|
has 'globalStorage' => (
|
||||||
|
@ -222,6 +257,34 @@ has 'ldapGroupRecursive' => (
|
||||||
documentation => 'LDAP recursive search in groups',
|
documentation => 'LDAP recursive search in groups',
|
||||||
);
|
);
|
||||||
|
|
||||||
|
has 'ldapPasswordResetAttribute' => (
|
||||||
|
is => 'rw',
|
||||||
|
isa => 'Str',
|
||||||
|
default => 'pwdReset',
|
||||||
|
documentation => 'LDAP password reset attribute',
|
||||||
|
);
|
||||||
|
|
||||||
|
has 'ldapPasswordResetAttributeValue' => (
|
||||||
|
is => 'rw',
|
||||||
|
isa => 'Str',
|
||||||
|
default => 'TRUE',
|
||||||
|
documentation => 'LDAP password reset value',
|
||||||
|
);
|
||||||
|
|
||||||
|
has 'ldapUsePasswordResetAttribute' => (
|
||||||
|
is => 'rw',
|
||||||
|
isa => 'Bool',
|
||||||
|
default => '1',
|
||||||
|
documentation => 'LDAP store reset flag in an attribute',
|
||||||
|
);
|
||||||
|
|
||||||
|
has 'loginHistoryEnabled' => (
|
||||||
|
is => 'rw',
|
||||||
|
isa => 'Bool',
|
||||||
|
default => '1',
|
||||||
|
documentation => 'Enable login history',
|
||||||
|
);
|
||||||
|
|
||||||
has 'logoutServices' => (
|
has 'logoutServices' => (
|
||||||
is => 'rw',
|
is => 'rw',
|
||||||
isa => 'HashRef',
|
isa => 'HashRef',
|
||||||
|
@ -256,6 +319,13 @@ has 'mailSessionKey' => (
|
||||||
documentation => 'Session parameter where mail is stored',
|
documentation => 'Session parameter where mail is stored',
|
||||||
);
|
);
|
||||||
|
|
||||||
|
has 'mailOnPasswordChange' => (
|
||||||
|
is => 'rw',
|
||||||
|
isa => 'Bool',
|
||||||
|
default => '0',
|
||||||
|
documentation => 'Send a mail when password is changed',
|
||||||
|
);
|
||||||
|
|
||||||
has 'mailSubject' => (
|
has 'mailSubject' => (
|
||||||
is => 'rw',
|
is => 'rw',
|
||||||
isa => 'Str',
|
isa => 'Str',
|
||||||
|
@ -283,6 +353,13 @@ has 'multiValuesSeparator' => (
|
||||||
|
|
||||||
## N
|
## N
|
||||||
|
|
||||||
|
has 'notificationWildcard' => (
|
||||||
|
is => 'rw',
|
||||||
|
isa => 'Str',
|
||||||
|
default => 'allusers',
|
||||||
|
documentation => 'Notification string to match all users',
|
||||||
|
);
|
||||||
|
|
||||||
has 'nullAuthnLevel' => (
|
has 'nullAuthnLevel' => (
|
||||||
is => 'rw',
|
is => 'rw',
|
||||||
isa => 'Int',
|
isa => 'Int',
|
||||||
|
@ -322,6 +399,13 @@ has 'portalAutocomplete' => (
|
||||||
documentation => 'Allow autocompletion of login input in portal',
|
documentation => 'Allow autocompletion of login input in portal',
|
||||||
);
|
);
|
||||||
|
|
||||||
|
has 'portalCheckLogins' => (
|
||||||
|
is => 'rw',
|
||||||
|
isa => 'Bool',
|
||||||
|
default => '1',
|
||||||
|
documentation => 'Display login history checkbox in portal',
|
||||||
|
);
|
||||||
|
|
||||||
has 'portalDisplayAppslist' => (
|
has 'portalDisplayAppslist' => (
|
||||||
is => 'rw',
|
is => 'rw',
|
||||||
isa => 'Str',
|
isa => 'Str',
|
||||||
|
@ -508,6 +592,13 @@ has 'SSLAuthnLevel' => (
|
||||||
documentation => 'SSL authentication level',
|
documentation => 'SSL authentication level',
|
||||||
);
|
);
|
||||||
|
|
||||||
|
has 'successLoginNumber' => (
|
||||||
|
is => 'rw',
|
||||||
|
isa => 'Int',
|
||||||
|
default => '5',
|
||||||
|
documentation => 'Number of success stored in login history',
|
||||||
|
);
|
||||||
|
|
||||||
## T
|
## T
|
||||||
|
|
||||||
has 'twitterAuthnLevel' => (
|
has 'twitterAuthnLevel' => (
|
||||||
|
@ -519,6 +610,13 @@ has 'twitterAuthnLevel' => (
|
||||||
|
|
||||||
## U
|
## U
|
||||||
|
|
||||||
|
has 'userControl' => (
|
||||||
|
is => 'rw',
|
||||||
|
isa => 'Str',
|
||||||
|
default => '^[\w\.\-@]+$',
|
||||||
|
documentation => 'Regular expression to validate login',
|
||||||
|
);
|
||||||
|
|
||||||
has 'userDB' => (
|
has 'userDB' => (
|
||||||
is => 'rw',
|
is => 'rw',
|
||||||
isa => 'Str',
|
isa => 'Str',
|
||||||
|
@ -526,6 +624,13 @@ has 'userDB' => (
|
||||||
documentation => 'User module',
|
documentation => 'User module',
|
||||||
);
|
);
|
||||||
|
|
||||||
|
has 'useSafeJail' => (
|
||||||
|
is => 'rw',
|
||||||
|
isa => 'Bool',
|
||||||
|
default => '1',
|
||||||
|
documentation => 'Activate Safe jail',
|
||||||
|
);
|
||||||
|
|
||||||
## V
|
## V
|
||||||
|
|
||||||
## W
|
## W
|
||||||
|
|
|
@ -271,8 +271,17 @@ sub new {
|
||||||
$self->{persistentStorageOptions} = $self->{globalStorageOptions};
|
$self->{persistentStorageOptions} = $self->{globalStorageOptions};
|
||||||
}
|
}
|
||||||
|
|
||||||
# Default values
|
# SAML
|
||||||
$self->setDefaultValues();
|
$self->{samlStorage} ||= $self->{globalStorage};
|
||||||
|
if ( !$self->{samlStorageOptions} or !%{ $self->{samlStorageOptions} } ) {
|
||||||
|
$self->{samlStorageOptions} = $self->{globalStorageOptions};
|
||||||
|
}
|
||||||
|
|
||||||
|
# CAS
|
||||||
|
$self->{casStorage} ||= $self->{globalStorage};
|
||||||
|
if ( !$self->{casStorageOptions} or !%{ $self->{casStorageOptions} } ) {
|
||||||
|
$self->{casStorageOptions} = $self->{globalStorageOptions};
|
||||||
|
}
|
||||||
|
|
||||||
# Load other storages if needed
|
# Load other storages if needed
|
||||||
foreach my $otherStorage ( $self->{samlStorage}, $self->{casStorage} ) {
|
foreach my $otherStorage ( $self->{samlStorage}, $self->{casStorage} ) {
|
||||||
|
@ -516,55 +525,6 @@ sub getConf {
|
||||||
1;
|
1;
|
||||||
}
|
}
|
||||||
|
|
||||||
##@method protected void setDefaultValues()
|
|
||||||
# Set default values.
|
|
||||||
sub setDefaultValues {
|
|
||||||
my $self = shift;
|
|
||||||
|
|
||||||
|
|
||||||
# SAML
|
|
||||||
$self->{samlStorage} ||= $self->{globalStorage};
|
|
||||||
if ( !$self->{samlStorageOptions} or !%{ $self->{samlStorageOptions} } ) {
|
|
||||||
$self->{samlStorageOptions} = $self->{globalStorageOptions};
|
|
||||||
}
|
|
||||||
|
|
||||||
# CAS
|
|
||||||
$self->{casStorage} ||= $self->{globalStorage};
|
|
||||||
if ( !$self->{casStorageOptions} or !%{ $self->{casStorageOptions} } ) {
|
|
||||||
$self->{casStorageOptions} = $self->{globalStorageOptions};
|
|
||||||
}
|
|
||||||
|
|
||||||
# Other
|
|
||||||
$self->{useSafeJail} = 1 unless defined $self->{useSafeJail};
|
|
||||||
$self->{ldapUsePasswordResetAttribute} = 1
|
|
||||||
unless ( defined( $self->{ldapUsePasswordResetAttribute} ) );
|
|
||||||
$self->{ldapPasswordResetAttribute} ||= "pwdReset";
|
|
||||||
$self->{ldapPasswordResetAttributeValue} ||= "TRUE";
|
|
||||||
$self->{mailOnPasswordChange} ||= 0;
|
|
||||||
|
|
||||||
# Captcha parameters
|
|
||||||
$self->{captcha_login_enabled} = 0
|
|
||||||
unless defined $self->{captcha_login_enabled};
|
|
||||||
$self->{captcha_mail_enabled} = 0
|
|
||||||
unless defined $self->{captcha_mail_enabled};
|
|
||||||
$self->{captcha_size} = 6 unless defined $self->{captcha_size};
|
|
||||||
|
|
||||||
# Notification
|
|
||||||
$self->{notificationWildcard} ||= "allusers";
|
|
||||||
|
|
||||||
# Login History
|
|
||||||
$self->{loginHistoryEnabled} = 1
|
|
||||||
unless defined $self->{loginHistoryEnabled};
|
|
||||||
$self->{successLoginNumber} = 5 unless defined $self->{successLoginNumber};
|
|
||||||
$self->{failedLoginNumber} = 5 unless defined $self->{failedLoginNumber};
|
|
||||||
$self->{portalCheckLogins} = 1
|
|
||||||
unless defined $self->{portalCheckLogins};
|
|
||||||
|
|
||||||
# XSS
|
|
||||||
$self->{checkXSS} = 1 unless defined $self->{checkXSS};
|
|
||||||
$self->{userControl} ||= '^[\w\.\-@]+$';
|
|
||||||
}
|
|
||||||
|
|
||||||
## @method protected void setHiddenFormValue(string fieldname, string value, string prefix, boolean base64)
|
## @method protected void setHiddenFormValue(string fieldname, string value, string prefix, boolean base64)
|
||||||
# Add element into $self->{portalHiddenFormValues}, those values could be
|
# Add element into $self->{portalHiddenFormValues}, those values could be
|
||||||
# used to hide values into HTML form.
|
# used to hide values into HTML form.
|
||||||
|
|
|
@ -136,6 +136,7 @@ ok(
|
||||||
passwordDB => 'Null',
|
passwordDB => 'Null',
|
||||||
domain => 'example.com',
|
domain => 'example.com',
|
||||||
trustedDomains => '.example2.com example3.com',
|
trustedDomains => '.example2.com example3.com',
|
||||||
|
checkXSS => 1,
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
'Portal object'
|
'Portal object'
|
||||||
|
|
|
@ -25,6 +25,7 @@ ok(
|
||||||
authentication => 'Null',
|
authentication => 'Null',
|
||||||
userDB => 'Null',
|
userDB => 'Null',
|
||||||
passwordDB => 'Null',
|
passwordDB => 'Null',
|
||||||
|
useSafeJail => 1,
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
'Portal object with Safe jail'
|
'Portal object with Safe jail'
|
||||||
|
|
|
@ -22,9 +22,9 @@ my $p = Lemonldap::NG::Portal::Simple->new(
|
||||||
'^/nok' => '$uid eq "toto"',
|
'^/nok' => '$uid eq "toto"',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
cfgNum => 42,
|
cfgNum => 42,
|
||||||
sessionInfo => { uid => "kharec" },
|
sessionInfo => { uid => "kharec" },
|
||||||
|
captcha_size => 6,
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user