File tree Expand file tree Collapse file tree 3 files changed +37
-2
lines changed Expand file tree Collapse file tree 3 files changed +37
-2
lines changed Original file line number Diff line number Diff line change 11use strict;
22use warnings;
33package Net::SAML2 ;
4- our $VERSION = " 0.71 " ;
4+ our $VERSION = " 0.72 " ;
55
66require 5.012;
77
Original file line number Diff line number Diff line change @@ -192,7 +192,7 @@ Returns the AuthnRequest as XML.
192192=cut
193193
194194my $samlp = [' samlp' => URN_PROTOCOL];
195- my $saml = [' samlp ' => URN_ASSERTION];
195+ my $saml = [' saml ' => URN_ASSERTION];
196196
197197sub as_xml {
198198 my ($self ) = @_ ;
Original file line number Diff line number Diff line change 1+ use strict;
2+ use warnings;
3+ use Net::SAML2;
4+ use MIME::Base64 qw/ decode_base64/ ;
5+ use XML::LibXML;
6+
7+ use Test::Lib;
8+ use Test::Net::SAML2;
9+ my $sp = net_saml2_sp();
10+
11+ my $metadata = path(' t/idp-metadata.xml' )-> slurp;
12+
13+ my $idp = Net::SAML2::IdP-> new_from_xml(
14+ xml => $metadata ,
15+ cacert => ' t/cacert.pem'
16+ );
17+
18+ my $authn = $sp -> authn_request(
19+ $idp -> sso_url(' urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST' ),
20+ $idp -> format || ' ' , # default format.
21+ )-> as_xml();
22+
23+ my $post = $sp -> sp_post_binding($idp , ' SAMLRequest' );
24+
25+ my $signed = decode_base64($post -> sign_xml($authn ));
26+
27+ my $dom = XML::LibXML-> load_xml( string => $signed );
28+
29+ my $parser = XML::LibXML::XPathContext-> new($dom );
30+ $parser -> registerNs(' saml2p' , ' urn:oasis:names:tc:SAML:2.0:protocol' );
31+ $parser -> registerNs(' saml2' , ' urn:oasis:names:tc:SAML:2.0:assertion' );
32+ $parser -> registerNs(' dsig' , ' http://www.w3.org/2000/09/xmldsig#' );
33+ ok($parser -> exists (' //dsig:Signature' ), " The XML is now signed" );
34+
35+ done_testing;
You can’t perform that action at this time.
0 commit comments