Skip to content

Commit 7869a2f

Browse files
committed
Add tests for part encrypted/part decrypted assertions
Signed-off-by: Wesley Schwengle <waterkip@cpan.org>
1 parent 9b37104 commit 7869a2f

File tree

2 files changed

+324
-0
lines changed

2 files changed

+324
-0
lines changed
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
use strict;
2+
use warnings;
3+
use Test::Lib;
4+
use Test::Net::SAML2;
5+
use MIME::Base64 qw/decode_base64/;
6+
7+
use Net::SAML2::Protocol::Assertion;
8+
9+
my $xml = path('t/data/eherkenning-decrypted.xml')->slurp;
10+
11+
my $assertion = Net::SAML2::Protocol::Assertion->new_from_xml(
12+
xml => $xml,
13+
);
14+
15+
isa_ok($assertion, 'Net::SAML2::Protocol::Assertion');
16+
17+
# Santize for easy comparison
18+
foreach my $v (values %{$assertion->attributes}) {
19+
foreach (@$v) {
20+
$_ =~ s/^\s+//;
21+
$_ =~ s/\s+$//;
22+
}
23+
}
24+
25+
cmp_deeply(
26+
$assertion->attributes,
27+
{
28+
'urn:etoegang:1.9:ServiceRestriction:Vestigingsnr' => ['0000123456789'],
29+
'urn:etoegang:core:ActingSubjectID' => ['5039c43b8e350bf6fb24382c9670debd878623680421a7b6f39ec749dfc0b4c7@0ae3c84bce4f060b25e89c0290f040d6'
30+
],
31+
'urn:etoegang:core:AuthorizationRegistryID' => ['urn:etoegang:MR:00000001234567890000:entities:9113'],
32+
'urn:etoegang:core:LegalSubjectID' => ['9876543210' ],
33+
'urn:etoegang:core:Representation' => ['true'],
34+
'urn:etoegang:core:ServiceID' => ['urn:etoegang:DV:0000000398765432100000:services:9009'],
35+
'urn:etoegang:core:ServiceUUID' => ['b2ba62a6-419c-4331-8fbb-40c7b589978d']
36+
},
37+
"Got all the decrypted attributes"
38+
);
39+
40+
done_testing;

0 commit comments

Comments
 (0)