Class LogoutRequest

java.lang.Object
org.codelibs.saml2.core.logout.LogoutRequest

public class LogoutRequest extends Object
LogoutRequest class of Java Toolkit. A class that implements SAML 2 Logout Request builder/parser/validator
  • Field Details

    • id

      public String id
      SAML LogoutRequest ID.
  • Constructor Details

  • Method Details

    • postProcessXml

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

      This method is invoked at construction time when no existing LogoutRequest message is found in the HTTP request (and hence in the logout request sending scenario only), 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:
      logoutRequestXml - the XML produced for this LogoutRequest by the standard implementation provided by LogoutRequest
      params - the logout request input parameters
      settings - the settings
      Returns:
      the post-processed XML for this LogoutRequest, which will then be returned by any call to getLogoutRequestXml()
    • getEncodedLogoutRequest

      public String getEncodedLogoutRequest(Boolean deflated)
      Parameters:
      deflated - If deflated or not the encoded Logout Request
      Returns:
      the base64 encoded unsigned Logout Request (deflated or not)
    • getEncodedLogoutRequest

      public String getEncodedLogoutRequest()
      Returns:
      the base64 encoded unsigned Logout Request (deflated or not)
    • getLogoutRequestXml

      public String getLogoutRequestXml()
      Returns:
      the plain XML Logout Request
    • isValid

      public boolean isValid()
      Determines if the SAML LogoutRequest is valid or not
      Returns:
      true if the SAML LogoutRequest is valid
    • getId

      public static String getId(Document samlLogoutRequestDocument)
      Returns the ID of the Logout Request Document.
      Parameters:
      samlLogoutRequestDocument - A DOMDocument object loaded from the SAML Logout Request.
      Returns:
      the ID of the Logout Request.
    • getIssueInstant

      public static Calendar getIssueInstant(Document samlLogoutRequestDocument)
      Returns the issue instant of the Logout Request Document.
      Parameters:
      samlLogoutRequestDocument - A DOMDocument object loaded from the SAML Logout Request.
      Returns:
      the issue instant of the Logout Request.
    • getId

      public static String getId(String samlLogoutRequestString)
      Returns the ID of the Logout Request String.
      Parameters:
      samlLogoutRequestString - A Logout Request string.
      Returns:
      the ID of the Logout Request.
    • getIssueInstant

      public static Calendar getIssueInstant(String samlLogoutRequestString)
      Returns the issue instant of the Logout Request Document.
      Parameters:
      samlLogoutRequestString - A DOMDocument object loaded from the SAML Logout Request.
      Returns:
      the issue instant of the Logout Request.
    • getNameIdData

      public static Map<String,String> getNameIdData(Document samlLogoutRequestDocument, PrivateKey key)
      Gets the NameID Data from the the Logout Request Document.
      Parameters:
      samlLogoutRequestDocument - A DOMDocument object loaded from the SAML Logout Request.
      key - The SP key to decrypt the NameID if encrypted
      Returns:
      the Name ID Data (Value, Format, NameQualifier, SPNameQualifier)
    • getNameIdData

      public static Map<String,String> getNameIdData(Document samlLogoutRequestDocument, PrivateKey key, boolean trimValue)
      Gets the NameID Data from the the Logout Request Document.
      Parameters:
      samlLogoutRequestDocument - A DOMDocument object loaded from the SAML Logout Request.
      key - The SP key to decrypt the NameID if encrypted
      trimValue - whether the extracted Name ID value should be trimmed
      Returns:
      the Name ID Data (Value, Format, NameQualifier, SPNameQualifier)
    • getNameIdData

      public static Map<String,String> getNameIdData(String samlLogoutRequestString, PrivateKey key)
      Gets the NameID Data from the the Logout Request String.
      Parameters:
      samlLogoutRequestString - A DOMDocument object loaded from the SAML Logout Request.
      key - The SP key to decrypt the NameID if encrypted
      Returns:
      the Name ID Data (Value, Format, NameQualifier, SPNameQualifier)
    • getNameIdData

      public static Map<String,String> getNameIdData(String samlLogoutRequestString, PrivateKey key, boolean trimValue)
      Gets the NameID Data from the the Logout Request String.
      Parameters:
      samlLogoutRequestString - A DOMDocument object loaded from the SAML Logout Request.
      key - The SP key to decrypt the NameID if encrypted
      trimValue - whether the extracted Name ID value should be trimmed
      Returns:
      the Name ID Data (Value, Format, NameQualifier, SPNameQualifier)
    • getNameId

      public static String getNameId(Document samlLogoutRequestDocument, PrivateKey key)
      Gets the NameID value provided from the SAML Logout Request Document.
      Parameters:
      samlLogoutRequestDocument - A DOMDocument object loaded from the SAML Logout Request.
      key - The SP key to decrypt the NameID if encrypted
      Returns:
      the Name ID value
    • getNameId

      public static String getNameId(Document samlLogoutRequestDocument, PrivateKey key, boolean trimValue)
      Gets the NameID value provided from the SAML Logout Request Document.
      Parameters:
      samlLogoutRequestDocument - A DOMDocument object loaded from the SAML Logout Request.
      key - The SP key to decrypt the NameID if encrypted
      trimValue - whether the extracted Name ID value should be trimmed
      Returns:
      the Name ID value
    • getNameId

      public static String getNameId(Document samlLogoutRequestDocument)
      Gets the NameID value provided from the SAML Logout Request Document.
      Parameters:
      samlLogoutRequestDocument - A DOMDocument object loaded from the SAML Logout Request.
      Returns:
      the Name ID value
    • getNameId

      public static String getNameId(String samlLogoutRequestString, PrivateKey key)
      Gets the NameID value provided from the SAML Logout Request String.
      Parameters:
      samlLogoutRequestString - A Logout Request string.
      key - The SP key to decrypt the NameID if encrypted
      Returns:
      the Name ID value
    • getNameId

      public static String getNameId(String samlLogoutRequestString, PrivateKey key, boolean trimValue)
      Gets the NameID value provided from the SAML Logout Request String.
      Parameters:
      samlLogoutRequestString - A Logout Request string.
      key - The SP key to decrypt the NameID if encrypted
      trimValue - whether the extracted Name ID value should be trimmed
      Returns:
      the Name ID value
    • getNameId

      public static String getNameId(String samlLogoutRequestString)
      Gets the NameID value provided from the SAML Logout Request String.
      Parameters:
      samlLogoutRequestString - A Logout Request string.
      Returns:
      the Name ID value
    • getIssuer

      public static String getIssuer(Document samlLogoutRequestDocument)
      Gets the Issuer from Logout Request Document.
      Parameters:
      samlLogoutRequestDocument - A DOMDocument object loaded from the SAML Logout Request.
      Returns:
      the issuer of the logout request
    • getIssuer

      public static String getIssuer(Document samlLogoutRequestDocument, boolean trim)
      Gets the Issuer from Logout Request Document.
      Parameters:
      samlLogoutRequestDocument - A DOMDocument object loaded from the SAML Logout Request.
      trim - whether the extracted issuer value should be trimmed
      Returns:
      the issuer of the logout request
    • getIssuer

      public static String getIssuer(String samlLogoutRequestString)
      Gets the Issuer from Logout Request String.
      Parameters:
      samlLogoutRequestString - A Logout Request string.
      Returns:
      the issuer of the logout request
    • getIssuer

      public static String getIssuer(String samlLogoutRequestString, boolean trim)
      Gets the Issuer from Logout Request String.
      Parameters:
      samlLogoutRequestString - A Logout Request string.
      trim - whether the extracted issuer value should be trimmed
      Returns:
      the issuer of the logout request
    • getSessionIndexes

      public static List<String> getSessionIndexes(Document samlLogoutRequestDocument)
      Gets the SessionIndexes from the LogoutRequest.
      Parameters:
      samlLogoutRequestDocument - A DOMDocument object loaded from the SAML Logout Request.
      Returns:
      the SessionIndexes
    • getSessionIndexes

      public static List<String> getSessionIndexes(Document samlLogoutRequestDocument, boolean trim)
      Gets the SessionIndexes from the LogoutRequest.
      Parameters:
      samlLogoutRequestDocument - A DOMDocument object loaded from the SAML Logout Request.
      trim - whether the extracted session indexes should be trimmed
      Returns:
      the SessionIndexes
    • getSessionIndexes

      public static List<String> getSessionIndexes(String samlLogoutRequestString)
      Gets the SessionIndexes from the LogoutRequest.
      Parameters:
      samlLogoutRequestString - A Logout Request string.
      Returns:
      the SessionIndexes
    • getSessionIndexes

      public static List<String> getSessionIndexes(String samlLogoutRequestString, boolean trim)
      Gets the SessionIndexes from the LogoutRequest.
      Parameters:
      samlLogoutRequestString - A Logout Request string.
      trim - whether the extracted session indexes should be trimmed
      Returns:
      the SessionIndexes
    • getError

      public String getError()
      After execute a validation process, if fails this method returns the cause
      Returns:
      the cause of the validation error
    • getValidationException

      public Exception getValidationException()
      After execute a validation process, if fails this method returns the Exception object
      Returns:
      the cause of the validation error
    • setValidationException

      protected void setValidationException(Exception validationException)
      Sets the validation exception that this LogoutRequest should return when a validation error occurs.
      Parameters:
      validationException - the validation exception to set
    • getId

      public String getId()
      Returns:
      the ID of the Logout Request
    • getIssueInstant

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