Skip to content

Commit c57b2b3

Browse files
authored
Merge pull request #118 from waterkip/GH-isdefault-default
Add isDefault when isDefault is missing in assertion_consumer_service
2 parents 0c57f7f + 33092f1 commit c57b2b3

File tree

2 files changed

+17
-7
lines changed

2 files changed

+17
-7
lines changed

lib/Net/SAML2/SP.pm

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,9 @@ around BUILDARGS => sub {
261261
}
262262
}
263263

264+
foreach (@{$args{assertion_consumer_service}}) {
265+
$_->{isDefault} = 'false' if !exists $_->{isDefault};
266+
}
264267

265268
return $self->$orig(%args);
266269
};

t/02-create-sp.t

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,6 @@ use URN::OASIS::SAML2 qw(:bindings :urn);
208208
{
209209
Binding => BINDING_HTTP_POST,
210210
Location => 'https://foo.example.com/acs-http-post',
211-
isDefault => 'false'
212211
},
213212
{
214213
Binding => BINDING_HTTP_ARTIFACT,
@@ -261,12 +260,20 @@ use URN::OASIS::SAML2 qw(:bindings :urn);
261260
"... and has the correct index");
262261
}
263262

264-
my $default = $sp->get_default_assertion_service;
265-
is($default->{Binding}, BINDING_HTTP_ARTIFACT,
266-
"We found the default assertion service");
267-
is($default->{Location}, 'https://foo.example.com/acs-http-artifact',
268-
"... with the correct URI");
269-
is($default->{index}, 2, "... and index");
263+
{
264+
my @warns;
265+
local $SIG{__WARN__} = sub { push(@warns, shift); };
266+
my $default = $sp->get_default_assertion_service;
267+
268+
is(@warns, 0, "No warnings for isDefault checks");
269+
270+
is($default->{Binding}, BINDING_HTTP_ARTIFACT,
271+
"We found the default assertion service");
272+
is($default->{Location}, 'https://foo.example.com/acs-http-artifact',
273+
"... with the correct URI");
274+
is($default->{index}, 2, "... and index");
275+
276+
}
270277

271278
throws_ok(
272279
sub {

0 commit comments

Comments
 (0)