NAME

Net::SAML2::Protocol::AuthnRequest

VERSION

version 0.25

SYNOPSIS

  my $authnreq = Net::SAML2::Protocol::AuthnRequest->new(
    id            => 'NETSAML2_Crypt::OpenSSL::Random::random_pseudo_bytes(16),
    issuer        => $self->{id},       # Service Provider (SP) Entity ID
    destination   => $destination,      # Identity Provider (IdP) SSO URL
    provider_name => $provider_name,    # Service Provider (SP) Human Readable Name
    issue_instant => DateTime->now,     # Defaults to Current Time
  );

  my $request_id = $authnreq->id;       # Store and Compare to InResponseTo

  or

  my $request_id = 'NETSAML2_' . unpack 'H*', Crypt::OpenSSL::Random::random_pseudo_bytes(16);

  my $authnreq = Net::SAML2::Protocol::AuthnRequest->as_xml(
    id            => $request_id,       # Unique Request ID will be returned in response
    issuer        => $self->{id},       # Service Provider (SP) Entity ID
    destination   => $destination,      # Identity Provider (IdP) SSO URL
    provider_name => $provider_name,    # Service Provider (SP) Human Readable Name
    issue_instant => DateTime->now,     # Defaults to Current Time
  );

NAME

Net::SAML2::Protocol::AuthnRequest - SAML2 AuthnRequest object

METHODS

new( ... )

Constructor. Creates an instance of the AuthnRequest object.

Important Note: Best practice is to always do this first. While it is possible to call as_xml() first you do not have to set the id as it will be set for you automatically.

However tracking the id is important for security to ensure that the response has the same id in the InResponseTo attribute.

Arguments:

nameidpolicy_format

Format attribute for NameIDPolicy

AuthnContextClassRef, AuthnContextDeclRef

Each one is an arrayref containing values for AuthnContextClassRef and AuthnContextDeclRef. If any is populated, the RequestedAuthnContext will be included in the request.

RequestedAuthnContext_Comparison

Value for the Comparison attribute in case RequestedAuthnContext is included (see above). Default value is exact.

as_xml( )

Returns the AuthnRequest as XML.

AUTHOR

Original Author: Chris Andrews <chrisa@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2020 by Chris Andrews and Others; in detail:

  Copyright 2010-2011  Chris Andrews
            2012       Peter Marschall
            2015       Mike Wisener
            2017       Alessandro Ranellucci
            2019-2020  Timothy Legge

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