Class Pac4jHTTPRedirectDeflateEncoder

java.lang.Object
net.shibboleth.shared.component.AbstractInitializableComponent
org.opensaml.messaging.encoder.AbstractMessageEncoder
org.pac4j.saml.transport.Pac4jHTTPRedirectDeflateEncoder
All Implemented Interfaces:
net.shibboleth.shared.component.Component, net.shibboleth.shared.component.DestructableComponent, net.shibboleth.shared.component.InitializableComponent, net.shibboleth.shared.component.UnmodifiableComponent, org.opensaml.messaging.encoder.MessageEncoder

public class Pac4jHTTPRedirectDeflateEncoder extends org.opensaml.messaging.encoder.AbstractMessageEncoder
Pac4j implementation extending directly the AbstractMessageEncoder as intermediate classes use the JEE HTTP response. It's mostly a copy/paste of the source code of these intermediate opensaml classes.
Since:
1.8
Author:
Misagh Moayyed
  • Field Summary

    Fields inherited from class org.opensaml.messaging.encoder.AbstractMessageEncoder

    BASE_PROTOCOL_MESSAGE_LOGGER_CATEGORY
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected String
    buildRedirectURL(org.opensaml.messaging.context.MessageContext messageContext, String endpoint, String message)
    Builds the URL to redirect the client to.
    protected void
    protected void
    protected String
    generateSignature(org.opensaml.security.credential.Credential signingCredential, String algorithmURI, String queryString)
    Generates the signature over the query string.
    protected URI
    getEndpointURL(org.opensaml.messaging.context.MessageContext messageContext)
    Gets the response URL from the message context.
    protected String
    getSignatureAlgorithmURI(org.opensaml.xmlsec.SignatureSigningParameters signingParameters)
    Gets the signature algorithm URI to use.
    protected Element
    marshallMessage(org.opensaml.core.xml.XMLObject message)
    Helper method that marshalls the given message.
    protected void
    removeSignature(org.opensaml.saml.common.SAMLObject message)
    Removes the signature from the protocol message.

    Methods inherited from class org.opensaml.messaging.encoder.AbstractMessageEncoder

    encode, getMessageContext, getMessageToLog, getProtocolMessageLogger, getProtocolMessageLoggerSubCategory, logEncodedMessage, prepareContext, serializeMessageForLogging, setMessageContext, setProtocolMessageLoggerSubCategory

    Methods inherited from class net.shibboleth.shared.component.AbstractInitializableComponent

    checkComponentActive, checkSetterPreconditions, destroy, doDestroy, ifDestroyedThrowDestroyedComponentException, ifInitializedThrowUnmodifiabledComponentException, ifNotInitializedThrowUninitializedComponentException, initialize, isDestroyed, isInitialized

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface net.shibboleth.shared.component.DestructableComponent

    destroy, isDestroyed

    Methods inherited from interface net.shibboleth.shared.component.InitializableComponent

    initialize, isInitialized
  • Constructor Details

    • Pac4jHTTPRedirectDeflateEncoder

      public Pac4jHTTPRedirectDeflateEncoder()
  • Method Details

    • doEncode

      protected void doEncode() throws org.opensaml.messaging.encoder.MessageEncodingException
      Specified by:
      doEncode in class org.opensaml.messaging.encoder.AbstractMessageEncoder
      Throws:
      org.opensaml.messaging.encoder.MessageEncodingException
    • doInitialize

      protected void doInitialize() throws net.shibboleth.shared.component.ComponentInitializationException
      Overrides:
      doInitialize in class org.opensaml.messaging.encoder.AbstractMessageEncoder
      Throws:
      net.shibboleth.shared.component.ComponentInitializationException
    • getEndpointURL

      protected URI getEndpointURL(org.opensaml.messaging.context.MessageContext messageContext) throws org.opensaml.messaging.encoder.MessageEncodingException
      Gets the response URL from the message context.
      Parameters:
      messageContext - current message context
      Returns:
      response URL from the message context
      Throws:
      org.opensaml.messaging.encoder.MessageEncodingException - throw if no relying party endpoint is available
    • removeSignature

      protected void removeSignature(org.opensaml.saml.common.SAMLObject message)
      Removes the signature from the protocol message.
      Parameters:
      message - current message context
    • marshallMessage

      protected Element marshallMessage(org.opensaml.core.xml.XMLObject message) throws org.opensaml.messaging.encoder.MessageEncodingException
      Helper method that marshalls the given message.
      Parameters:
      message - message the marshall and serialize
      Returns:
      marshalled message
      Throws:
      org.opensaml.messaging.encoder.MessageEncodingException - thrown if the give message can not be marshalled into DOM
    • buildRedirectURL

      protected String buildRedirectURL(org.opensaml.messaging.context.MessageContext messageContext, String endpoint, String message) throws org.opensaml.messaging.encoder.MessageEncodingException
      Builds the URL to redirect the client to.
      Parameters:
      messageContext - current message context
      endpoint - endpoint URL to send encoded message to
      message - Deflated and Base64 encoded message
      Returns:
      URL to redirect client to
      Throws:
      org.opensaml.messaging.encoder.MessageEncodingException - thrown if the SAML msg is neither a RequestAbstractType or Response
    • getSignatureAlgorithmURI

      protected String getSignatureAlgorithmURI(org.opensaml.xmlsec.SignatureSigningParameters signingParameters) throws org.opensaml.messaging.encoder.MessageEncodingException
      Gets the signature algorithm URI to use.
      Parameters:
      signingParameters - the signing parameters to use
      Returns:
      signature algorithm to use with the associated signing credential
      Throws:
      org.opensaml.messaging.encoder.MessageEncodingException - thrown if the algorithm URI is not supplied explicitly and could not be derived from the supplied credential
    • generateSignature

      protected String generateSignature(org.opensaml.security.credential.Credential signingCredential, String algorithmURI, String queryString) throws org.opensaml.messaging.encoder.MessageEncodingException
      Generates the signature over the query string.
      Parameters:
      signingCredential - credential that will be used to sign query string
      algorithmURI - algorithm URI of the signing credential
      queryString - query string to be signed
      Returns:
      base64 encoded signature of query string
      Throws:
      org.opensaml.messaging.encoder.MessageEncodingException - there is an error computing the signature