public class HTTPArtifactEncoder extends BaseSAML2MessageEncoder
| Modifier and Type | Field and Description |
|---|---|
private SAMLArtifactMap |
artifactMap
SAML artifact map used to store created artifacts for later retrieval.
|
static java.lang.String |
DEFAULT_TEMPLATE_ID
Default template ID.
|
private byte[] |
defaultArtifactType
Default artifact type to use when encoding messages.
|
private org.slf4j.Logger |
log
Class logger.
|
private boolean |
postEncoding
Whether the POST encoding should be used, instead of GET.
|
private org.apache.velocity.app.VelocityEngine |
velocityEngine
Velocity engine used to evaluate the template when performing POST encoding.
|
private java.lang.String |
velocityTemplateId
ID of the velocity template used when performing POST encoding.
|
| Constructor and Description |
|---|
HTTPArtifactEncoder()
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
protected AbstractSAML2Artifact |
buildArtifact(MessageContext<SAMLObject> messageContext)
Builds the SAML 2 artifact for the outgoing message.
|
protected void |
doDestroy() |
protected void |
doEncode()
Performs the encoding logic.
|
protected void |
doInitialize() |
SAMLArtifactMap |
getArtifactMap()
Get the SAML artifact map to use.
|
java.lang.String |
getBindingURI()
Gets the SAML binding URI supported by this encoder.
|
protected void |
getEncode()
Performs HTTP GET based encoding.
|
private java.lang.String |
getInboundMessageIssuer(MessageContext<SAMLObject> messageContext)
Get the requester.
|
private java.lang.String |
getOutboundMessageIssuer(MessageContext<SAMLObject> messageContext)
Get the outbound message issuer.
|
private byte[] |
getSAMLArtifactType(MessageContext<SAMLObject> messageContext)
Get the SAML artifact type from the message context.
|
org.apache.velocity.app.VelocityEngine |
getVelocityEngine()
Get the VelocityEngine instance.
|
java.lang.String |
getVelocityTemplateId()
Get the Velocity template id.
|
boolean |
isPostEncoding()
Get whether the encoder will encode the artifact via POST encoding.
|
protected void |
postEncode()
Performs HTTP POST based encoding.
|
void |
setArtifactMap(SAMLArtifactMap newArtifactMap)
Set the SAML artifact map to use.
|
void |
setPostEncoding(boolean post)
Set whether the encoder will encode the artifact via POST encoding.
|
void |
setVelocityEngine(org.apache.velocity.app.VelocityEngine newVelocityEngine)
Set the VelocityEngine instance.
|
void |
setVelocityTemplateId(java.lang.String newVelocityTemplateId)
Set the Velocity template id.
|
private void |
storeSAMLArtifactType(MessageContext<SAMLObject> messageContext,
byte[] artifactType)
Store the SAML artifact type in the message context.
|
getEndpointURLencode, getMessageToLog, logEncodedMessage, marshallMessagegetHttpServletResponse, setHttpServletResponsegetMessageContext, prepareContext, setMessageContextdestroy, initialize, isDestroyed, isInitializedclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitencode, prepareContext, setMessageContext@Nonnull @NotEmpty public static final java.lang.String DEFAULT_TEMPLATE_ID
@Nonnull private final org.slf4j.Logger log
private boolean postEncoding
@Nullable private org.apache.velocity.app.VelocityEngine velocityEngine
@Nonnull @NotEmpty private java.lang.String velocityTemplateId
@NonnullAfterInit private SAMLArtifactMap artifactMap
@Nonnull @NotEmpty private byte[] defaultArtifactType
public java.lang.String getBindingURI()
public boolean isPostEncoding()
public void setPostEncoding(boolean post)
post - true if POST encoding will be used, false if GET encoding will be used@Nullable public org.apache.velocity.app.VelocityEngine getVelocityEngine()
public void setVelocityEngine(@Nullable
org.apache.velocity.app.VelocityEngine newVelocityEngine)
newVelocityEngine - the new VelocityEngine instane@Nonnull @NotEmpty public java.lang.String getVelocityTemplateId()
Defaults to DEFAULT_TEMPLATE_ID.
public void setVelocityTemplateId(@Nonnull @NotEmpty
java.lang.String newVelocityTemplateId)
Defaults to DEFAULT_TEMPLATE_ID.
newVelocityTemplateId - the new Velocity template id@NonnullAfterInit public SAMLArtifactMap getArtifactMap()
public void setArtifactMap(@Nonnull
SAMLArtifactMap newArtifactMap)
newArtifactMap - the new artifactMapprotected void doInitialize()
throws net.shibboleth.utilities.java.support.component.ComponentInitializationException
doInitialize in class AbstractHttpServletResponseMessageEncoder<SAMLObject>net.shibboleth.utilities.java.support.component.ComponentInitializationExceptionprotected void doDestroy()
doDestroy in class AbstractHttpServletResponseMessageEncoder<SAMLObject>protected void doEncode()
throws MessageEncodingException
doEncode in class AbstractMessageEncoder<SAMLObject>MessageEncodingException - thrown if there is a problem encoding the messageprotected void postEncode()
throws MessageEncodingException
MessageEncodingException - thrown if there is a problem POST encoding the artifactprotected void getEncode()
throws MessageEncodingException
MessageEncodingException - thrown if there is a problem GET encoding the artifact@Nonnull protected AbstractSAML2Artifact buildArtifact(@Nonnull MessageContext<SAMLObject> messageContext) throws MessageEncodingException
messageContext - current request contextMessageEncodingException - thrown if the artifact can not be created@Nullable
private java.lang.String getOutboundMessageIssuer(@Nonnull
MessageContext<SAMLObject> messageContext)
messageContext - the message context@Nullable
private java.lang.String getInboundMessageIssuer(@Nonnull
MessageContext<SAMLObject> messageContext)
messageContext - the message contextprivate void storeSAMLArtifactType(@Nonnull
MessageContext<SAMLObject> messageContext,
@Nonnull @NotEmpty
byte[] artifactType)
messageContext - the message contextartifactType - the artifact type to store@Nullable
private byte[] getSAMLArtifactType(@Nonnull
MessageContext<SAMLObject> messageContext)
messageContext - the message context