From a0d375446201e5a77f231a8f53191aa01462d520 Mon Sep 17 00:00:00 2001 From: Timothy Legge Date: Sun, 21 Apr 2019 21:04:33 -0300 Subject: [PATCH] Cleanup whitespace issues --- lib/Net/SAML2/Binding/POST.pm | 6 +++--- lib/Net/SAML2/IdP.pm | 6 +++--- lib/Net/SAML2/Protocol/Assertion.pm | 4 ++-- lib/Net/SAML2/Protocol/AuthnRequest.pm | 10 +++++----- lib/Net/SAML2/SP.pm | 2 +- lib/Net/SAML2/XML/Sig.pm | 4 ++-- 6 files changed, 16 insertions(+), 16 deletions(-) diff --git a/lib/Net/SAML2/Binding/POST.pm b/lib/Net/SAML2/Binding/POST.pm index 68ee30e..6fc3e44 100644 --- a/lib/Net/SAML2/Binding/POST.pm +++ b/lib/Net/SAML2/Binding/POST.pm @@ -64,11 +64,11 @@ sub handle_response { my $x = Net::SAML2::XML::Sig->new($xml_opts); my $ret = $x->verify($xml); die "signature check failed" unless $ret; - + if ($self->cacert) { my $cert = $x->signer_cert or die "Certificate not provided and not in SAML Response, cannot validate"; - + my $ca = Crypt::OpenSSL::VerifyX509->new($self->cacert); if ($ca->verify($cert)) { return sprintf("%s (verified)", $cert->subject); @@ -76,7 +76,7 @@ sub handle_response { return 0; } } - + return 1; } diff --git a/lib/Net/SAML2/IdP.pm b/lib/Net/SAML2/IdP.pm index 95c6738..323db26 100644 --- a/lib/Net/SAML2/IdP.pm +++ b/lib/Net/SAML2/IdP.pm @@ -127,12 +127,12 @@ sub new_from_xml { $data->{NameIDFormat}->{unspecified} = 'urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified'; $data->{DefaultFormat} = 'unspecified' unless exists $data->{DefaultFormat}; } - + for my $key ( $xpath->findnodes('//md:EntityDescriptor/md:IDPSSODescriptor/md:KeyDescriptor')) { my $use = $key->getAttribute('use') || 'signing'; - + # We can't select by ds:KeyInfo/ds:X509Data/ds:X509Certificate # because of https://rt.cpan.org/Public/Bug/Display.html?id=8784 my ($text) @@ -173,7 +173,7 @@ sub new_from_xml { sub BUILD { my($self) = @_; - + if ($self->cacert) { my $ca = Crypt::OpenSSL::VerifyX509->new($self->cacert); diff --git a/lib/Net/SAML2/Protocol/Assertion.pm b/lib/Net/SAML2/Protocol/Assertion.pm index 93c17ac..d8e1b11 100644 --- a/lib/Net/SAML2/Protocol/Assertion.pm +++ b/lib/Net/SAML2/Protocol/Assertion.pm @@ -128,10 +128,10 @@ sub valid { return 0 unless defined $audience; return 0 unless($audience eq $self->audience); - + return 0 unless !defined $in_response_to or $in_response_to eq $self->in_response_to; - + my $now = DateTime::->now; # not_before is "NotBefore" element - exact match is ok diff --git a/lib/Net/SAML2/Protocol/AuthnRequest.pm b/lib/Net/SAML2/Protocol/AuthnRequest.pm index 1b23095..1277cb3 100644 --- a/lib/Net/SAML2/Protocol/AuthnRequest.pm +++ b/lib/Net/SAML2/Protocol/AuthnRequest.pm @@ -73,8 +73,8 @@ sub as_xml { my ($self) = @_; my $saml = 'urn:oasis:names:tc:SAML:2.0:assertion'; my $samlp = 'urn:oasis:names:tc:SAML:2.0:protocol'; - my $x = XML::Writer->new( - OUTPUT => 'self', + my $x = XML::Writer->new( + OUTPUT => 'self', NAMESPACES => 1, FORCED_NS_DECLS => [$saml, $samlp], PREFIX_MAP => { @@ -88,9 +88,9 @@ sub as_xml { IssueInstant => $self->issue_instant, Version => '2.0', }; - + my $issuer_attrs = {}; - + my $protocol_bindings = { 'HTTP-POST' => 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST' }; @@ -119,7 +119,7 @@ sub as_xml { } } } - + $x->startTag([$samlp, 'AuthnRequest'], %$req_atts); $x->dataElement([$saml, 'Issuer'], $self->issuer, %$issuer_attrs); if ($self->nameid) { diff --git a/lib/Net/SAML2/SP.pm b/lib/Net/SAML2/SP.pm index 9fe2063..d774b53 100644 --- a/lib/Net/SAML2/SP.pm +++ b/lib/Net/SAML2/SP.pm @@ -37,7 +37,7 @@ base for all SP service URLs =item B -SP's identity URI. +SP's identity URI. =item B diff --git a/lib/Net/SAML2/XML/Sig.pm b/lib/Net/SAML2/XML/Sig.pm index 5abff81..f1bdb85 100644 --- a/lib/Net/SAML2/XML/Sig.pm +++ b/lib/Net/SAML2/XML/Sig.pm @@ -177,7 +177,7 @@ sub verify { if ( ! $self->$verify_method($keyinfo_nodeset->get_node(0), $signed_info_canon, $signature) ) { print STDERR "Failed to verify using $verify_method\n"; return 0; - } + } last; } } @@ -192,7 +192,7 @@ sub verify { my $digest = $self->{digest_method}->($canonical); return 0 unless ($refdigest eq _trim(encode_base64($digest, ''))); } - + return 1; }