Class AuthnRequest

java.lang.Object
com.onelogin.saml2.authn.AuthnRequest

public class AuthnRequest extends Object
AuthNRequest class of OneLogin's Java Toolkit. A class that implements SAML 2 Authentication Request
  • Field Details

    • LOGGER

      private static final org.slf4j.Logger LOGGER
      Private property to construct a logger for this class.
    • authnRequestString

      private final String authnRequestString
      SAML AuthNRequest string
    • id

      private final String id
      SAML AuthNRequest ID.
    • settings

      private final Saml2Settings settings
      Settings data.
    • issueInstant

      private final Calendar issueInstant
      Time stamp that indicates when the AuthNRequest was created
  • Constructor Details

  • Method Details

    • postProcessXml

      protected String postProcessXml(String authnRequestXml, AuthnRequestParams params, Saml2Settings settings)
      Allows for an extension class to post-process the AuthnRequest XML generated for this request, in order to customize the result.

      This method is invoked at construction time, after all the other fields of this class have already been initialised. Its default implementation simply returns the input XML as-is, with no change.

      Parameters:
      authnRequestXml - the XML produced for this AuthnRequest by the standard implementation provided by AuthnRequest
      params - the authentication request input parameters
      settings - the settings
      Returns:
      the post-processed XML for this AuthnRequest, which will then be returned by any call to getAuthnRequestXml()
    • getEncodedAuthnRequest

      public String getEncodedAuthnRequest(Boolean deflated) throws IOException
      Parameters:
      deflated - If deflated or not the encoded AuthnRequest
      Returns:
      the base64 encoded unsigned AuthnRequest (deflated or not)
      Throws:
      IOException
    • getEncodedAuthnRequest

      public String getEncodedAuthnRequest() throws IOException
      Returns:
      base64 encoded, unsigned AuthnRequest (deflated or not)
      Throws:
      IOException
    • getAuthnRequestXml

      public String getAuthnRequestXml()
      Returns:
      unsigned plain-text AuthnRequest.
    • generateSubstitutor

      private org.apache.commons.lang3.text.StrSubstitutor generateSubstitutor(AuthnRequestParams params, Saml2Settings settings)
      Substitutes AuthnRequest variables within a string by values.
      Parameters:
      params - the authentication request input parameters
      settings - Saml2Settings object. Setting data
      Returns:
      the StrSubstitutor object of the AuthnRequest
    • getAuthnRequestTemplate

      private static StringBuilder getAuthnRequestTemplate()
      Returns:
      the AuthnRequest's template
    • getId

      public String getId()
      Returns:
      the generated id of the AuthnRequest message
    • getIssueInstant

      public Calendar getIssueInstant()
      Returns the issue instant of this message.
      Returns:
      a new Calendar instance carrying the issue instant of this message