Skip to content
Snippets Groups Projects
Commit 9e04149b authored by Guillaume ROUSSE's avatar Guillaume ROUSSE
Browse files

fix type-filtering in metadata

Also exclude entities without identifiable type when filtering on type.
parent 8901e33f
No related branches found
No related tags found
No related merge requests found
......@@ -55,6 +55,7 @@ sub parse {
next unless $child->nodeType() == XML_ELEMENT_NODE;
if ($child->localname() eq 'IDPSSODescriptor') {
# skip immediatly if requested type differs
next ENTITY if $args{type} && $args{type} ne 'idp';
$data->{type} = 'idp';
......@@ -81,6 +82,7 @@ sub parse {
}
} elsif ($child->localname() eq 'SPSSODescriptor') {
# skip immediatly if requested type differs
next ENTITY if $args{type} && $args{type} ne 'sp';
$data->{type} = 'sp';
......@@ -169,6 +171,10 @@ sub parse {
}
}
# skip finaly if specific type was requested,
# and no identifiable type was found
next ENTITY if $args{type} && !$data->{type};
push @array, $data;
}
......
......@@ -100,6 +100,6 @@ ok(scalar @$none == 0, 'filtered metadata extraction: result count');
my $idp = $metadata->parse(type => 'idp');
ok(defined $idp, 'filtered metadata extraction: defined result');
ok(ref $idp eq 'ARRAY', 'filtered metadata extraction: result type');
ok(scalar @$idp == 2561, 'filtered metadata extraction: result count');
ok(scalar @$idp == 2556, 'filtered metadata extraction: result count');
is($idp->[0]->{type}, 'idp', 'filtered entity has expected type');
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment