NAME

Net::SAML2::Binding::Redirect - Net::SAML2::Binding::Redirect - HTTP Redirect binding for SAML

VERSION

version 0.60

SYNOPSIS

my $redirect = Net::SAML2::Binding::Redirect->new(
  key     => '/path/to/SPsign-nopw-key.pem',		# Service Provider (SP) private key
  url     => $sso_url,							# Service Provider Single Sign Out URL
  param   => 'SAMLRequest' OR 'SAMLResponse',		# Type of request
  cert    => $idp->cert('signing')				# Identity Provider (IdP) certificate
  sig_hash => 'sha1', 'sha224', 'sha256', 'sha384', 'sha512'  # Signature to sign request
);

my $url = $redirect->sign($authnreq);

my $ret = $redirect->verify($url);

METHODS

new( ... )

Constructor. Creates an instance of the Redirect binding.

Arguments:

key

The SP's (Service Provider) also known as your application's signing key that your application uses to sign the AuthnRequest. Some IdPs may not verify the signature. Required with param being SAMLRequest.

cert

IdP's (Identity Provider's) certificate that is used to verify a signed Redirect from the IdP. It is used to verify the signature of the Redirect response. Required with param being SAMLResponse.

url

IdP's SSO (Single Sign Out) service url for the Redirect binding Required with param being SAMLRequest.

param

query param name to use (SAMLRequest, SAMLResponse) Defaults to SAMLRequest.

sig_hash

RSA hash to use to sign request

Supported:

sha1, sha224, sha256, sha384, sha512

Defaults to sha1.

debug

Output extra debugging information

sign( $request, $relaystate )

Signs the given request, and returns the URL to which the user's browser should be redirected.

Accepts an optional RelayState parameter, a string which will be returned to the requestor when the user returns from the authentication process with the IdP.

verify( $query_string )

Decode a Redirect binding URL.

Verifies the signature on the response.

Requires the *raw* query string to be passed, because URI parses and re-encodes URI-escapes in uppercase (%3f becomes %3F, for instance), which leads to signature verification failures if the other party uses lower case (or mixed case).

AUTHOR

Chris Andrews <chrisa@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2022 by Chris Andrews and Others, see the git log.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.