Default value must not be a scalar for hash containers (#882)
This commit is contained in:
parent
6505ff4de7
commit
d877623f6d
|
@ -219,7 +219,7 @@ sub defaultValues {
|
|||
'samlAuthnContextMapTLSClient' => 5,
|
||||
'samlCommonDomainCookieActivation' => 0,
|
||||
'samlEntityID' => '#PORTAL#/saml/metadata',
|
||||
'samlIDPMetaDataExportedAttributes' => ';;;',
|
||||
'samlIDPMetaDataExportedAttributes' => {},
|
||||
'samlIDPMetaDataOptionsAdaptSessionUtime' => 0,
|
||||
'samlIDPMetaDataOptionsAllowLoginFromIDP' => 0,
|
||||
'samlIDPMetaDataOptionsAllowProxiedAuthn' => 0,
|
||||
|
@ -267,7 +267,7 @@ sub defaultValues {
|
|||
'samlServicePrivateKeySigPwd' => '',
|
||||
'samlServicePublicKeyEnc' => '',
|
||||
'samlServicePublicKeySig' => '',
|
||||
'samlSPMetaDataExportedAttributes' => ';;;',
|
||||
'samlSPMetaDataExportedAttributes' => {},
|
||||
'samlSPMetaDataOptionsCheckSLOMessageSignature' => 0,
|
||||
'samlSPMetaDataOptionsCheckSSOMessageSignature' => 0,
|
||||
'samlSPMetaDataOptionsEnableIDPInitiatedURL' => 0,
|
||||
|
|
|
@ -186,7 +186,7 @@ qr/^(?:(?:\-+\s*BEGIN\s+(?:PUBLIC\s+KEY|CERTIFICATE)\s*\-+\r?\n)?[a-zA-Z0-9\/\+\
|
|||
'test' => sub {
|
||||
my $test =
|
||||
grep( { $_ eq $_[0]; }
|
||||
map( { $$_{'k'}; } @{ $_[2]{'select'}; } ) );
|
||||
map( { $_->{'k'}; } @{ $_[2]{'select'}; } ) );
|
||||
return $test
|
||||
? 1
|
||||
: ( 0, "Invalid value '$_[0]' for this select" );
|
||||
|
@ -1003,7 +1003,7 @@ qr/^(?:(?:(?:(?:[a-zA-Z0-9][-a-zA-Z0-9]*)?[a-zA-Z0-9])[.])*(?:[a-zA-Z][-a-zA-Z0-
|
|||
'default' => 'ldap://localhost',
|
||||
'test' => sub {
|
||||
my $l = shift();
|
||||
my (@s) = split( /[\s,]+/, $l, 0 );
|
||||
my @s = split( /[\s,]+/, $l, 0 );
|
||||
foreach my $s (@s) {
|
||||
return 0, qq[Bad ldap uri "$s"]
|
||||
unless $s =~
|
||||
|
@ -1807,7 +1807,7 @@ qr/^(?:(?:https?):\/\/(?:(?:(?:(?:(?:(?:[a-zA-Z0-9][-a-zA-Z0-9]*)?[a-zA-Z0-9])[.
|
|||
'type' => 'text'
|
||||
},
|
||||
'samlIDPMetaDataExportedAttributes' => {
|
||||
'default' => ';;;',
|
||||
'default' => {},
|
||||
'keyTest' => qr/^[a-zA-Z](?:[a-zA-Z0-9_\-\.]*\w)?$/,
|
||||
'msgFail' => '__badValue__',
|
||||
'test' => qr/\w/,
|
||||
|
@ -2098,7 +2098,7 @@ qr/^(?:(?:https?):\/\/(?:(?:(?:(?:(?:(?:[a-zA-Z0-9][-a-zA-Z0-9]*)?[a-zA-Z0-9])[.
|
|||
'type' => 'RSAPublicKeyOrCertificate'
|
||||
},
|
||||
'samlSPMetaDataExportedAttributes' => {
|
||||
'default' => ';;;',
|
||||
'default' => {},
|
||||
'keyTest' => qr/^[a-zA-Z](?:[a-zA-Z0-9_\-\.]*\w)?$/,
|
||||
'msgFail' => '__badValue__',
|
||||
'test' => qr/\w/,
|
||||
|
|
|
@ -1250,7 +1250,7 @@ sub attributes {
|
|||
keyMsgFail => 'Bad metadata name',
|
||||
test => qr/\w/,
|
||||
msgFail => '__badValue__',
|
||||
default => ';;;',
|
||||
default => {},
|
||||
},
|
||||
samlIDPMetaDataXML => {
|
||||
type => 'file',
|
||||
|
@ -1367,7 +1367,7 @@ sub attributes {
|
|||
keyMsgFail => 'Bad metadata name',
|
||||
test => qr/\w/,
|
||||
msgFail => '__badValue__',
|
||||
default => ';;;',
|
||||
default => {},
|
||||
},
|
||||
samlSPMetaDataXML => {
|
||||
type => 'file',
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -16,7 +16,7 @@ ok( $types = Lemonldap::NG::Manager::Build::Attributes::types(), 'Get types' );
|
|||
$count += 2;
|
||||
|
||||
foreach my $attr ( keys %$attrs ) {
|
||||
next if($attr=~/^virtualHosts|.*MetaDataNodes|applicationList$/);
|
||||
next if ( $attr =~ /^virtualHosts|.*MetaDataNodes|applicationList$/ );
|
||||
ok(
|
||||
(
|
||||
ref( $attrs->{$attr}->{test} )
|
||||
|
@ -35,6 +35,15 @@ foreach my $attr ( keys %$attrs ) {
|
|||
);
|
||||
$count++;
|
||||
}
|
||||
if ( $attr =~ qr/^$simpleHashKeys$/o or $attrs->{$attr}->{type} =~ /Container$/ ) {
|
||||
if ( $attrs->{$attr}->{default} ) {
|
||||
ok(
|
||||
ref( $attrs->{$attr}->{default} ) eq 'HASH',
|
||||
"$attr default value is a hash ref"
|
||||
);
|
||||
$count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
done_testing($count);
|
||||
|
|
Loading…
Reference in New Issue
Block a user