Skip to content

Commit 67b9ab1

Browse files
authored
Merge pull request #21 from timlegge/issue19
Fixes #19: SP Metadata AuthnRequestsSigned and WantAssertionsSigned s…
2 parents 5377ecd + 339d5f9 commit 67b9ab1

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

lib/Net/SAML2/SP.pm

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,17 @@ SP contact email address
7373
SP organization url. This is optional and url will be used as in
7474
previous versions if this is not provided.
7575
76+
=item B<authnreq_signed>
77+
78+
Specifies in the metadata whether the SP signs the AuthnRequest
79+
Optional (0 or 1) defaults to 1 (TRUE) if not specified.
80+
81+
=item B<want_assertions_signed>
82+
83+
Specifies in the metadata whether the SP wants the Assertion from
84+
the IdP to be signed
85+
Optional (0 or 1) defaults to 1 (TRUE) if not specified.
86+
7687
=back
7788
7889
=cut
@@ -90,6 +101,9 @@ has 'org_url' => (isa => 'Str', is => 'ro', required => 0);
90101

91102
has '_cert_text' => (isa => 'Str', is => 'rw', required => 0);
92103

104+
has 'authnreq_signed' => (isa => 'Bool', is => 'ro', required => 0);
105+
has 'want_assertions_signed' => (isa => 'Bool', is => 'ro', required => 0);
106+
93107
=head2 BUILD ( hashref of the parameters passed to the constructor )
94108
95109
Called after the object is created to load the cert from a file
@@ -296,8 +310,8 @@ sub metadata {
296310
entityID => $self->id },
297311
$x->SPSSODescriptor(
298312
$md,
299-
{ AuthnRequestsSigned => '1',
300-
WantAssertionsSigned => '1',
313+
{ AuthnRequestsSigned => defined($self->authnreq_signed) ? $self->authnreq_signed : '1',
314+
WantAssertionsSigned => defined($self->want_assertions_signed) ? $self->want_assertions_signed : '1',
301315
errorURL => $self->url . '/saml/error',
302316
protocolSupportEnumeration => 'urn:oasis:names:tc:SAML:2.0:protocol' },
303317
$x->KeyDescriptor(

t/lib/Test/Net/SAML2/Util.pm

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ sub net_saml2_sp {
3939
org_display_name => 'Test',
4040
org_contact => 'test@example.com',
4141
org_url => 'http://www.example.com',
42+
authnreq_signed => '0',
43+
want_assertions_signed => '0',
4244
@_,
4345
);
4446
}

0 commit comments

Comments
 (0)