Add config test for CAS App url presence/uniqueness (#2240)

The issuer code only looks at the host part
Moo
Maxime Besson 6 years ago
parent 7d5d62541a
commit 51762ca85f
  1. 34
      lemonldap-ng-manager/lib/Lemonldap/NG/Manager/Conf/Tests.pm

@ -801,6 +801,40 @@ sub tests {
return ( $res, join( ', ', @msg ) );
},
# CAS APP URL must be unique
casAppHostnameUniqueness => sub {
return 1
unless ( $conf->{casAppMetaDataOptions}
and %{ $conf->{casAppMetaDataOptions} } );
my @msg;
my $res = 1;
my %casHosts;
foreach my $casConfKey ( keys %{ $conf->{casAppMetaDataOptions} } )
{
my $appUrl =
$conf->{casAppMetaDataOptions}->{$casConfKey}
->{casAppMetaDataOptionsService}
|| "";
$appUrl =~ m#^(https?://[^/]+)(/.*)?$#;
my $appHost = $1;
unless ($appHost) {
push @msg,
"$clientConfKey CAS Application has no Service URL";
$res = 0;
next;
}
if ( defined $casHosts{$appHost} ) {
push @msg,
"$casConfKey and $casHosts{$appHost} have the same Service hostname";
$res = 0;
next;
}
$casHosts{$appHost} = $casConfKey;
}
return ( $res, join( ', ', @msg ) );
},
# Notification system required with removed SF notification
sfRemovedNotification => sub {
return 1 unless ( $conf->{sfRemovedMsgRule} );

Loading…
Cancel
Save