Skip to content

Commit ca4fcda

Browse files
committed
Add addtional test for NameID formats
Signed-off-by: Wesley Schwengle <waterkip@cpan.org>
1 parent 67438b5 commit ca4fcda

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

t/07-logout-request.t

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use strict;
22
use warnings;
33
use Test::Lib;
44
use Test::Net::SAML2;
5-
use URN::OASIS::SAML2 qw(:urn);
5+
use URN::OASIS::SAML2 qw(:urn NAMEID_EMAIL);
66

77
use Net::SAML2::Protocol::LogoutRequest;
88

@@ -50,6 +50,25 @@ is(
5050
"We don't have SPProvidedID as an attribute in the nameid"
5151
);
5252

53+
{
54+
my $lor = Net::SAML2::Protocol::LogoutRequest->new(%args, nameid_format => NAMEID_EMAIL());
55+
my $xpath = get_xpath(
56+
$lor->as_xml,
57+
samlp => URN_PROTOCOL,
58+
saml => URN_ASSERTION,
59+
);
60+
test_xml_attribute_ok($xpath, '/samlp:LogoutRequest/@ID', qr/^NETSAML2_/);
61+
test_xml_attribute_ok($xpath, '/samlp:LogoutRequest/@IssueInstant', 'foo');
62+
my $name_id = get_single_node_ok($xpath, '/samlp:LogoutRequest/saml:NameID');
63+
is($name_id->getAttribute('Format'), NAMEID_EMAIL());
64+
65+
foreach (qw(NameQualifier SPNameQualifier SPProvidedID)) {
66+
is($name_id->getAttribute($_),
67+
undef, "We don't have $_ as an attribute in the nameid");
68+
}
69+
70+
}
71+
5372
{
5473
my $lor = Net::SAML2::Protocol::LogoutRequest->new(%args,
5574
sp_provided_id => "Some provided ID");

0 commit comments

Comments
 (0)