Package org.pac4j.saml.transport
Class Pac4jHTTPPostEncoder
java.lang.Object
net.shibboleth.shared.component.AbstractInitializableComponent
org.opensaml.messaging.encoder.AbstractMessageEncoder
org.pac4j.saml.transport.Pac4jHTTPPostEncoder
- 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 Pac4jHTTPPostEncoder
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 -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidprotected voiddoEncode()protected voidprotected URIgetEndpointURL(org.opensaml.messaging.context.MessageContext messageContext) Gets the response URL from the message context.org.apache.velocity.app.VelocityEngineGet the VelocityEngine instance.Get the Velocity template id.protected ElementmarshallMessage(org.opensaml.core.xml.XMLObject message) Helper method that marshalls the given message.protected voidpopulateVelocityContext(org.apache.velocity.VelocityContext velocityContext, org.opensaml.messaging.context.MessageContext messageContext, String endpointURL) Populate the Velocity context instance which will be used to render the POST body.protected voidpostEncode(org.opensaml.messaging.context.MessageContext messageContext, String endpointURL) voidsetVelocityEngine(org.apache.velocity.app.VelocityEngine newVelocityEngine) Set the VelocityEngine instance.voidsetVelocityTemplateId(String newVelocityTemplateId) Set the Velocity template id.Methods inherited from class org.opensaml.messaging.encoder.AbstractMessageEncoder
encode, getMessageContext, prepareContext, setMessageContextMethods inherited from class net.shibboleth.shared.component.AbstractInitializableComponent
checkComponentActive, checkSetterPreconditions, destroy, ifDestroyedThrowDestroyedComponentException, ifInitializedThrowUnmodifiabledComponentException, ifNotInitializedThrowUninitializedComponentException, initialize, isDestroyed, isInitializedMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.shibboleth.shared.component.DestructableComponent
destroy, isDestroyedMethods inherited from interface net.shibboleth.shared.component.InitializableComponent
initialize, isInitialized
-
Field Details
-
DEFAULT_TEMPLATE_ID
Default template ID.- See Also:
-
-
Constructor Details
-
Pac4jHTTPPostEncoder
-
-
Method Details
-
doDestroy
protected void doDestroy()- Overrides:
doDestroyin classorg.opensaml.messaging.encoder.AbstractMessageEncoder
-
doInitialize
protected void doInitialize() throws net.shibboleth.shared.component.ComponentInitializationException- Overrides:
doInitializein classorg.opensaml.messaging.encoder.AbstractMessageEncoder- Throws:
net.shibboleth.shared.component.ComponentInitializationException
-
doEncode
protected void doEncode() throws org.opensaml.messaging.encoder.MessageEncodingException- Specified by:
doEncodein classorg.opensaml.messaging.encoder.AbstractMessageEncoder- Throws:
org.opensaml.messaging.encoder.MessageEncodingException
-
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
-
postEncode
protected void postEncode(org.opensaml.messaging.context.MessageContext messageContext, String endpointURL) throws org.opensaml.messaging.encoder.MessageEncodingException - Throws:
org.opensaml.messaging.encoder.MessageEncodingException
-
getVelocityTemplateId
Get the Velocity template id.Defaults to
DEFAULT_TEMPLATE_ID.- Returns:
- return the Velocity template id
-
setVelocityTemplateId
Set the Velocity template id.Defaults to
DEFAULT_TEMPLATE_ID.- Parameters:
newVelocityTemplateId- the new Velocity template id
-
getVelocityEngine
public org.apache.velocity.app.VelocityEngine getVelocityEngine()Get the VelocityEngine instance.- Returns:
- return the VelocityEngine instance
-
setVelocityEngine
public void setVelocityEngine(org.apache.velocity.app.VelocityEngine newVelocityEngine) Set the VelocityEngine instance.- Parameters:
newVelocityEngine- the new VelocityEngine instane
-
populateVelocityContext
protected void populateVelocityContext(org.apache.velocity.VelocityContext velocityContext, org.opensaml.messaging.context.MessageContext messageContext, String endpointURL) throws org.opensaml.messaging.encoder.MessageEncodingException Populate the Velocity context instance which will be used to render the POST body.- Parameters:
velocityContext- the Velocity context instance to populate with datamessageContext- the SAML message context source of dataendpointURL- endpoint URL to which to encode message- Throws:
org.opensaml.messaging.encoder.MessageEncodingException- thrown if there is a problem encoding the message
-
getBindingURI
-
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 its DOM representation
-