Skip to content

Commit 92a1eb5

Browse files
committed
Support Unsigned encrypted Assertions
1 parent 39016c6 commit 92a1eb5

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lib/Net/SAML2/Protocol/Assertion.pm

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,12 +103,15 @@ sub new_from_xml {
103103
$xpath = XML::LibXML::XPathContext->new($dom);
104104
$xpath->registerNs('saml', 'urn:oasis:names:tc:SAML:2.0:assertion');
105105
$xpath->registerNs('samlp', 'urn:oasis:names:tc:SAML:2.0:protocol');
106+
$xpath->registerNs('dsig', 'http://www.w3.org/2000/09/xmldsig#');
106107
$xpath->registerNs('xenc', 'http://www.w3.org/2001/04/xmlenc#');
107108

108109
my $xml_opts->{ no_xml_declaration } = 1;
109110

110111
my $assert = $xpath->findnodes('//saml:Assertion')->[0];
111-
if (defined $assert) {
112+
my @signedinfo = $xpath->findnodes('dsig:Signature', $assert);
113+
114+
if (defined $assert && (scalar @signedinfo ne 0)) {
112115
my $x = Net::SAML2::XML::Sig->new($xml_opts);
113116
my $ret = $x->verify($assert->serialize);
114117
die "Decrypted Assertion signature check failed" unless $ret;

0 commit comments

Comments
 (0)