Sort by spoofed and real attributes (#1658)

This commit is contained in:
Christophe Maudoux 2019-04-29 21:48:52 +02:00
parent 58279c029f
commit f1c82e52cd
1 changed files with 23 additions and 1 deletions

View File

@ -286,8 +286,9 @@ sub _urlFormat {
$port ||= '';
$vhost =~ s/:\d+$//;
$vhost .= $self->conf->{domain} unless ( $vhost =~ /\./ );
#$appuri ||= '/';
return lc ("$proto$vhost$port") . "$appuri";
return lc("$proto$vhost$port") . "$appuri";
}
sub _userDatas {
@ -385,6 +386,27 @@ sub _splitAttributes {
}
push @$others, $element unless $ok;
}
# Sort real and spoofed attributes if required
if ( $self->conf->{impersonationRule} ) {
$self->logger->debug('Dispatching real and spoofed attributes...');
my ( $realAttrs, $spoofedAttrs ) = ( [], [] );
my $prefix = "$self->{conf}->{impersonationPrefix}";
while (@$others) {
my $element = shift @$others;
$self->logger->debug(
'Processing attribute: ' . Data::Dumper::Dumper($element) );
if ( $element->{key} =~ /^$prefix.+$/ ) {
push @$realAttrs, $element;
$self->logger->debug(' -> Real attribute');
}
else {
push @$spoofedAttrs, $element;
$self->logger->debug(' -> Spoofed attribute');
}
}
@$others = ( @$spoofedAttrs, @$realAttrs );
}
return [ $grps, $mcrs, $others ];
}