Class PostRequestHttpObject<T extends org.opensaml.saml.saml2.core.RequestAbstractType>
java.lang.Object
se.swedenconnect.opensaml.saml2.request.PostRequestHttpObject<T>
- Type Parameters:
T
- the type of the request
- All Implemented Interfaces:
RequestHttpObject<T>
public class PostRequestHttpObject<T extends org.opensaml.saml.saml2.core.RequestAbstractType>
extends Object
implements RequestHttpObject<T>
A RequestHttpObject for sending using HTTP POST.
If signature credentials are supplied when creating the object the request will be signed.
- Author:
- Martin Lindström (martin@idsec.se)
-
Constructor Summary
ConstructorDescriptionPostRequestHttpObject
(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.PostRequestHttpObject
(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 TypeMethodDescriptionReturns 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 theRequestHttpObject.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.toString()
-
Constructor Details
-
PostRequestHttpObject
public PostRequestHttpObject(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 objectrelayState
- the relay statesignatureCredentials
- optional signature credentialsendpoint
- the endpoint where we send this request torecipientMetadata
- the recipient metadata (may benull
)- Throws:
org.opensaml.messaging.encoder.MessageEncodingException
- for encoding errorsorg.opensaml.xmlsec.signature.support.SignatureException
- for signature errors
-
PostRequestHttpObject
public PostRequestHttpObject(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 objectrelayState
- the relay statesignatureCredentials
- optional signature credentialsendpoint
- the endpoint where we send this request torecipientMetadata
- the recipient metadata (may be null)defaultSignatureSigningConfiguration
- the default signature configuration for the application. If null, the value returned fromSecurityConfigurationSupport.getGlobalSignatureSigningConfiguration()
will be used- Throws:
org.opensaml.messaging.encoder.MessageEncodingException
- for encoding errorsorg.opensaml.xmlsec.signature.support.SignatureException
- for signature errors
-
-
Method Details
-
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 interfaceRequestHttpObject<T extends org.opensaml.saml.saml2.core.RequestAbstractType>
- Returns:
- the URL to use when sending the user to the Identity Provider
-
getDestinationUrl
Returns the URL to where we are sending the request. If the method is "POST", this will be the same value as forRequestHttpObject.getSendUrl()
, and if the method is "GET", the value is just the destination and not the query parameters.- Specified by:
getDestinationUrl
in interfaceRequestHttpObject<T extends org.opensaml.saml.saml2.core.RequestAbstractType>
- Returns:
- the destination URL
-
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 interfaceRequestHttpObject<T extends org.opensaml.saml.saml2.core.RequestAbstractType>
- Returns:
- the HTTP method to use
-
getRequestParameters
If theRequestHttpObject.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 interfaceRequestHttpObject<T extends org.opensaml.saml.saml2.core.RequestAbstractType>
- Returns:
- a Map holding the request parameters (POST body or query parameters)
-
getHttpHeaders
Returns a mapping of header names and values that should be used when sending the request.- Specified by:
getHttpHeaders
in interfaceRequestHttpObject<T extends org.opensaml.saml.saml2.core.RequestAbstractType>
- Returns:
- HTTP headers
-
getRequest
Returns the actual request (for easy access to its elements).- Specified by:
getRequest
in interfaceRequestHttpObject<T extends org.opensaml.saml.saml2.core.RequestAbstractType>
- Returns:
- the request
-
toString
-