Skip to content

Commit 67438b5

Browse files
committed
Correctly test NameID attributes
In 6c63ed1 we introduced some logic to make NameID attributes optional. On the checks is that urn:oasis:names:tc:SAML:2.0:nameidformat:persistent is special. There are two problems with this, one: urn:oasis:names:tc:SAML:2.0:nameidformat:persistent should be urn:oasis:names:tc:SAML:2.0:nameid-format:persistent. And two: the test in t/07-logout-request.t should test that SPNameQualifier and NameQualifier are actually set and they are now not set (for the test that is). By fixing the typo, we need to change the tests to test the correct thing. Closes: #213 Signed-off-by: Wesley Schwengle <waterkip@cpan.org>
1 parent 6f7d6cb commit 67438b5

File tree

3 files changed

+12
-9
lines changed

3 files changed

+12
-9
lines changed

dist.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ XML::Enc = 0.13
5959
XML::Sig = 0.64
6060
; Here because it isn't provided by Crypt::OpenSSL::RSA
6161
Crypt::OpenSSL::Bignum = 0
62-
URN::OASIS::SAML2 = 0.003
62+
URN::OASIS::SAML2 = 0.004
6363
XML::Generator = 1.13
6464

6565
[Prereqs / TestRequires]

lib/Net/SAML2/Protocol/LogoutRequest.pm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use MooseX::Types::Common::String qw/ NonEmptySimpleStr /;
77
use MooseX::Types::URI qw/ Uri /;
88
use Net::SAML2::XML::Util qw/ no_comments /;
99
use XML::Generator;
10-
use URN::OASIS::SAML2 qw(:urn);
10+
use URN::OASIS::SAML2 qw(:urn NAMEID_PERSISTENT);
1111
use XML::LibXML::XPathContext;
1212

1313
with 'Net::SAML2::Role::ProtocolMessage';
@@ -123,7 +123,7 @@ around BUILDARGS => sub {
123123
my $self = shift;
124124
my %args = @_;
125125

126-
if ($args{nameid_format} && $args{nameid_format} eq 'urn:oasis:names:tc:SAML:2.0:nameidformat:persistent') {
126+
if ($args{nameid_format} && $args{nameid_format} eq NAMEID_PERSISTENT()) {
127127
$args{include_name_qualifier} = 1;
128128
}
129129

t/07-logout-request.t

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,17 @@ test_xml_attribute_ok($xpath, '/samlp:LogoutRequest/@IssueInstant', 'foo');
3939
my $name_id = get_single_node_ok($xpath, '/samlp:LogoutRequest/saml:NameID');
4040
is($name_id->getAttribute('Format'), $args{nameid_format});
4141

42-
foreach (qw(NameQualifier SPNameQualifier SPProvidedID)) {
43-
is(
44-
$name_id->getAttribute($_),
45-
undef,
46-
"We don't have $_ as an attribute in the nameid"
47-
);
42+
foreach (qw(NameQualifier SPNameQualifier)) {
43+
isnt($name_id->getAttribute($_),
44+
undef, "We don't have $_ as an attribute in the nameid");
4845
}
4946

47+
is(
48+
$name_id->getAttribute('SPProvidedID'),
49+
undef,
50+
"We don't have SPProvidedID as an attribute in the nameid"
51+
);
52+
5053
{
5154
my $lor = Net::SAML2::Protocol::LogoutRequest->new(%args,
5255
sp_provided_id => "Some provided ID");

0 commit comments

Comments
 (0)