Skip to content

Commit

Permalink
Cleanup whitespace issues
Browse files Browse the repository at this point in the history
  • Loading branch information
timlegge committed Apr 22, 2019
1 parent 6177d15 commit a0d3754
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 16 deletions.
6 changes: 3 additions & 3 deletions lib/Net/SAML2/Binding/POST.pm
Original file line number Diff line number Diff line change
Expand Up @@ -64,19 +64,19 @@ 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);
} else {
return 0;
}
}

return 1;
}

Expand Down
6 changes: 3 additions & 3 deletions lib/Net/SAML2/IdP.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -173,7 +173,7 @@ sub new_from_xml {

sub BUILD {
my($self) = @_;

if ($self->cacert) {
my $ca = Crypt::OpenSSL::VerifyX509->new($self->cacert);

Expand Down
4 changes: 2 additions & 2 deletions lib/Net/SAML2/Protocol/Assertion.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 5 additions & 5 deletions lib/Net/SAML2/Protocol/AuthnRequest.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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 => {
Expand All @@ -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'
};
Expand Down Expand Up @@ -119,7 +119,7 @@ sub as_xml {
}
}
}

$x->startTag([$samlp, 'AuthnRequest'], %$req_atts);
$x->dataElement([$saml, 'Issuer'], $self->issuer, %$issuer_attrs);
if ($self->nameid) {
Expand Down
2 changes: 1 addition & 1 deletion lib/Net/SAML2/SP.pm
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ base for all SP service URLs
=item B<id>
SP's identity URI.
SP's identity URI.
=item B<cert>
Expand Down
4 changes: 2 additions & 2 deletions lib/Net/SAML2/XML/Sig.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand All @@ -192,7 +192,7 @@ sub verify {
my $digest = $self->{digest_method}->($canonical);
return 0 unless ($refdigest eq _trim(encode_base64($digest, '')));
}

return 1;
}

Expand Down

0 comments on commit a0d3754

Please sign in to comment.