T
- the concrete request typepublic interface RequestHttpObjectBuilder<T extends RequestAbstractType> extends SAMLObjectBuilder<T>
A request builder instance may only be used to create one request and should not be re-used. Instead a new builder should be created using a builder factory.
By default the request builder creates a Request object based on the SP and IdP settings in metadata and the configuration of the builder factory, but it is also possible to control the request by using chaining calls as illustrated below:
RequestHttpObject request = builder.relayState("hello").binding("urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST").build();
Modifier and Type | Method and Description |
---|---|
String |
binding()
Returns the SAML binding that should be used when sending the request.
|
RequestHttpObjectBuilder<T> |
binding(String binding)
The builder is created with the SAML binding to use when sending the request message (redirect or post).
|
RequestHttpObject<T> |
buildHttpObject()
Compiles the request by invoking
SAMLObjectBuilder.build() , optionally signs it and encodes it according to the configured
binding and returns a RequestHttpObject that can be used by the SP application to send the request to the Identity
Provider. |
RequestHttpObjectBuilder<T> |
endpoint(String url)
For testing purposes
|
String |
entityID()
Returns the entityID of the Service Provider that this builder is serving.
|
String |
idpEntityID()
Returns the entityID for the IdP to which we are constructing the request.
|
boolean |
performSignature()
Predicate that tells whether the request being created will be signed or not.
|
RequestHttpObjectBuilder<T> |
performSignature(boolean signatureFlag)
The RequestBuilder reads the federation metadata and determines that a request should be signed if based on
requirements from the IdP and SP.
|
String |
relayState()
Returns the SAML RelayState that has been configured for this builder.
|
RequestHttpObjectBuilder<T> |
relayState(String relayState)
Installs the SAML RelayState to use when sending the request.
|
T |
request()
Returns a reference to the request object that this builder object is handling.
|
RequestHttpObjectBuilder<T> |
request(T request)
Replaces the request object that this builder currently is processing with a new and updated object.
|
X509Credential |
signatureCredentials()
Returns the signature credentials this builder object has been configured to use during request signing.
|
RequestHttpObjectBuilder<T> |
signatureCredentials(X509Credential signatureCredentials)
Using this method the signature credentials for the builder object may be changed.
|
build
RequestHttpObject<T> buildHttpObject() throws SignatureException, ResolverException, MessageEncodingException
SAMLObjectBuilder.build()
, optionally signs it and encodes it according to the configured
binding and returns a RequestHttpObject that can be used by the SP application to send the request to the Identity
Provider.SignatureException
- for signature creation errorsResolverException
- for metadata errorsMessageEncodingException
- for encoding errorsString entityID()
String idpEntityID()
RequestHttpObjectBuilder<T> relayState(String relayState)
relayState
- the RelayStateString relayState()
null
if none has been configuredRequestHttpObjectBuilder<T> request(T request)
Note: Care should be taken when using this method, and if only a particular attribute or element of the request
should be modified it is generally better to use the request()
method that returns a reference to the
contained request message, or the special purpose methods for this purpose.
request
- the request object to install to the builderrequest()
T request()
Also see the methods that directly modifies attributes and elements.
RequestHttpObjectBuilder<T> binding(String binding) throws ResolverException
binding
- the URI of the SAML binding to use (e.g., "urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect")ResolverException
- if the binding supplied does not match a binding found in the IdP:s entity descriptorString binding()
RequestHttpObjectBuilder<T> performSignature(boolean signatureFlag)
Using this method it is possible to override the default behaviour by explicitly state the request should be signed, or not signed.
signatureFlag
- flag telling whether the request being created should be signed or notboolean performSignature()
true
is returned, and false
otherwiseRequestHttpObjectBuilder<T> signatureCredentials(X509Credential signatureCredentials)
signatureCredentials
- the "new" signature credentialsX509Credential signatureCredentials()
RequestHttpObjectBuilder<T> endpoint(String url)
The method will change the endpoint to where the request will be sent, but will not modify the
Destination
attribute of the request element.
url
- the endpoint to assignCopyright © 2018 Litsec AB. All rights reserved.