Skip to content

Commit

Permalink
Use "true" and "false" for more boolean values
Browse files Browse the repository at this point in the history
Some IdPs (KPN) don't understand "1" and "0" as boolean values, but
insist that the standard says only "true" or "false" are allowed.

A previous commit (bcfc4d2) already fixed
several occurences, but it turned out there are more booleans hiding
in the metadata XML.
  • Loading branch information
Martijn van de Streek committed May 21, 2024
1 parent a19257d commit 931b29f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lib/Net/SAML2/AttributeConsumingService.pm
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ sub to_xml {
$self->namespace,
{
index => $self->index,
isDefault => $self->default,
isDefault => $self->default ? 'true' : 'false',
},
$xml->ServiceName($self->namespace, undef, $self->service_name),
$self->_has_service_description ? $xml->ServiceDescription($self->namespace, undef, $self->service_description) : (),
Expand Down
2 changes: 1 addition & 1 deletion lib/Net/SAML2/RequestedAttribute.pm
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ sub _build_attributes {
my $self = shift;

my %attrs = (
$self->required ? (isRequired => 1) : (),
$self->required ? (isRequired => 'true') : (),
Name => $self->name,
$self->_has_friendly ? (FriendlyName => $self->friendly_name) : (),
);
Expand Down
6 changes: 3 additions & 3 deletions t/02-create-sp.t
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ use URN::OASIS::SAML2 qw(:bindings :urn);
{
Binding => BINDING_HTTP_ARTIFACT,
Location => 'https://foo.example.com/acs-http-artifact',
isDefault => 0,
isDefault => 'false',
}
],
error_url => 'https://foo.example.com/error-url',
Expand Down Expand Up @@ -469,7 +469,7 @@ use URN::OASIS::SAML2 qw(:bindings :urn);
my $acs = get_single_node_ok($node, '//md:AttributeConsumingService');

is($acs->getAttribute('index'), 1, ".. index is 1");
is($acs->getAttribute('isDefault'), 0, "Not the default");
is($acs->getAttribute('isDefault'), 'false', "Not the default");


my @child = $acs->childNodes();
Expand All @@ -486,7 +486,7 @@ use URN::OASIS::SAML2 qw(:bindings :urn);
is($child[1]->getAttribute('FriendlyName'),
'foo', ".. with the correct friendly name");
is($child[1]->getAttribute('Name'), 'urn:foo:bar', ".. and name");
is($child[1]->getAttribute('isRequired'), '1', ".. and requiredness");
is($child[1]->getAttribute('isRequired'), 'true', ".. and requiredness");
}

{
Expand Down

0 comments on commit 931b29f

Please sign in to comment.