Class RedirectRequestHttpObject<T extends org.opensaml.saml.saml2.core.RequestAbstractType>

java.lang.Object
net.shibboleth.shared.component.AbstractInitializableComponent
org.opensaml.messaging.encoder.AbstractMessageEncoder
org.opensaml.messaging.encoder.servlet.AbstractHttpServletResponseMessageEncoder
org.opensaml.messaging.encoder.servlet.BaseHttpServletResponseXMLMessageEncoder
org.opensaml.saml.common.binding.impl.BaseSAMLHttpServletResponseEncoder
org.opensaml.saml.saml2.binding.encoding.impl.BaseSAML2MessageEncoder
org.opensaml.saml.saml2.binding.encoding.impl.HTTPRedirectDeflateEncoder
se.swedenconnect.opensaml.saml2.request.RedirectRequestHttpObject<T>
Type Parameters:
T - the type of the request
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, org.opensaml.messaging.encoder.servlet.HttpServletResponseMessageEncoder, org.opensaml.saml.common.binding.encoding.SAMLMessageEncoder, RequestHttpObject<T>

public class RedirectRequestHttpObject<T extends org.opensaml.saml.saml2.core.RequestAbstractType> extends org.opensaml.saml.saml2.binding.encoding.impl.HTTPRedirectDeflateEncoder implements RequestHttpObject<T>
A RequestHttpObject for sending using HTTP GET (redirect binding).

If signature credentials are supplied when creating the object the request will be signed.

Author:
Martin Lindström (martin@idsec.se)
  • Field Summary

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

    BASE_PROTOCOL_MESSAGE_LOGGER_CATEGORY
  • Constructor Summary

    Constructors
    Constructor
    Description
    RedirectRequestHttpObject(T request, String relayState, org.opensaml.security.x509.X509Credential signatureCredentials, String endpoint, org.opensaml.saml.saml2.metadata.EntityDescriptor recipientMetadata)
    Constructor that puts together the resulting object.
    RedirectRequestHttpObject(T request, String relayState, org.opensaml.security.x509.X509Credential signatureCredentials, String endpoint, org.opensaml.saml.saml2.metadata.EntityDescriptor recipientMetadata, org.opensaml.xmlsec.SignatureSigningConfiguration defaultSignatureSigningConfiguration)
    Constructor that puts together the resulting object.
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the URL to where we are sending the request.
    Returns a mapping of header names and values that should be used when sending the request.
    Returns the HTTP method that should be used to send the request, via the user agent, to the Identity Provider.
    Returns the actual request (for easy access to its elements).
    If the RequestHttpObject.getMethod() returns "POST" the request should be posted to the Identity Provider.
    Returns the complete URL that the SP application should use when the user agent is sent to the Identity Provider.

    Methods inherited from class org.opensaml.saml.saml2.binding.encoding.impl.HTTPRedirectDeflateEncoder

    buildRedirectURL, deflateAndBase64Encode, doEncode, generateSignature, getBindingURI, getSignatureAlgorithmURI, removeDisallowedQueryParams, removeSignature

    Methods inherited from class org.opensaml.saml.saml2.binding.encoding.impl.BaseSAML2MessageEncoder

    getEndpointURL

    Methods inherited from class org.opensaml.messaging.encoder.servlet.BaseHttpServletResponseXMLMessageEncoder

    encode, marshallMessage, serializeMessageForLogging

    Methods inherited from class org.opensaml.messaging.encoder.servlet.AbstractHttpServletResponseMessageEncoder

    doInitialize, getHttpServletResponse, getHttpServletResponseSupplier, setHttpServletResponseSupplier

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

    getMessageContext, getMessageToLog, getProtocolMessageLogger, getProtocolMessageLoggerSubCategory, logEncodedMessage, prepareContext, 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, 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

    Methods inherited from interface org.opensaml.messaging.encoder.MessageEncoder

    encode, prepareContext, setMessageContext
  • Constructor Details

    • RedirectRequestHttpObject

      public RedirectRequestHttpObject(T request, String relayState, org.opensaml.security.x509.X509Credential signatureCredentials, String endpoint, org.opensaml.saml.saml2.metadata.EntityDescriptor recipientMetadata) throws org.opensaml.messaging.encoder.MessageEncodingException, org.opensaml.xmlsec.signature.support.SignatureException
      Constructor that puts together the resulting object.
      Parameters:
      request - the request object
      relayState - the relay state
      signatureCredentials - optional signature credentials
      endpoint - the endpoint where we send this request to
      recipientMetadata - the recipient metadata (may be null)
      Throws:
      org.opensaml.messaging.encoder.MessageEncodingException - for encoding errors
      org.opensaml.xmlsec.signature.support.SignatureException - for signature errors
    • RedirectRequestHttpObject

      public RedirectRequestHttpObject(T request, String relayState, org.opensaml.security.x509.X509Credential signatureCredentials, String endpoint, org.opensaml.saml.saml2.metadata.EntityDescriptor recipientMetadata, org.opensaml.xmlsec.SignatureSigningConfiguration defaultSignatureSigningConfiguration) throws org.opensaml.messaging.encoder.MessageEncodingException, org.opensaml.xmlsec.signature.support.SignatureException
      Constructor that puts together the resulting object.
      Parameters:
      request - the request object
      relayState - the relay state
      signatureCredentials - optional signature credentials
      endpoint - the endpoint where we send this request to
      recipientMetadata - the recipient metadata (may be null)
      defaultSignatureSigningConfiguration - the default signature configuration for the application. If null, the value returned from SecurityConfigurationSupport.getGlobalSignatureSigningConfiguration() will be used
      Throws:
      org.opensaml.messaging.encoder.MessageEncodingException - for encoding errors
      org.opensaml.xmlsec.signature.support.SignatureException - for signature errors
  • Method Details

    • getSendUrl

      public String getSendUrl()
      Returns the complete URL that the SP application should use when the user agent is sent to the Identity Provider.

      For a redirect, this URL could look something like: https://www.theidp.com/auth?SAMLRequest=<encoded request>&RelayState=abcd.

      Note: Additional query parameters may be added to the URL by the using system.
      Specified by:
      getSendUrl in interface RequestHttpObject<T extends org.opensaml.saml.saml2.core.RequestAbstractType>
      Returns:
      the URL to use when sending the user to the Identity Provider
    • getDestinationUrl

      public String getDestinationUrl()
      Returns the URL to where we are sending the request. If the method is "POST", this will be the same value as for RequestHttpObject.getSendUrl(), and if the method is "GET", the value is just the destination and not the query parameters.
      Specified by:
      getDestinationUrl in interface RequestHttpObject<T extends org.opensaml.saml.saml2.core.RequestAbstractType>
      Returns:
      the destination URL
    • getMethod

      public String getMethod()
      Returns the HTTP method that should be used to send the request, via the user agent, to the Identity Provider. Possible values for this implementation is "GET" (redirect) and "POST".
      Specified by:
      getMethod in interface RequestHttpObject<T extends org.opensaml.saml.saml2.core.RequestAbstractType>
      Returns:
      the HTTP method to use
    • getRequestParameters

      public Map<String,String> getRequestParameters()
      If the RequestHttpObject.getMethod() returns "POST" the request should be posted to the Identity Provider. The request parameters are represented using a Map where the entries represent parameter names and values.

      Note: for the "GET" method this method returns the query parameters that are part of RequestHttpObject.getSendUrl().

      The parameter values are not URL-encoded.

      Specified by:
      getRequestParameters in interface RequestHttpObject<T extends org.opensaml.saml.saml2.core.RequestAbstractType>
      Returns:
      a Map holding the request parameters (POST body or query parameters)
    • getHttpHeaders

      public Map<String,String> getHttpHeaders()
      Returns a mapping of header names and values that should be used when sending the request.
      Specified by:
      getHttpHeaders in interface RequestHttpObject<T extends org.opensaml.saml.saml2.core.RequestAbstractType>
      Returns:
      HTTP headers
    • getRequest

      public T getRequest()
      Returns the actual request (for easy access to its elements).
      Specified by:
      getRequest in interface RequestHttpObject<T extends org.opensaml.saml.saml2.core.RequestAbstractType>
      Returns:
      the request
    • toString

      public String toString()
      Overrides:
      toString in class Object