Package org.pac4j.saml.transport
Class Pac4jHTTPPostEncoder
java.lang.Object
net.shibboleth.utilities.java.support.component.AbstractInitializableComponent
org.opensaml.messaging.encoder.AbstractMessageEncoder
org.pac4j.saml.transport.Pac4jHTTPPostEncoder
- All Implemented Interfaces:
net.shibboleth.utilities.java.support.component.Component
,net.shibboleth.utilities.java.support.component.DestructableComponent
,net.shibboleth.utilities.java.support.component.InitializableComponent
,net.shibboleth.utilities.java.support.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
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
protected void
doEncode()
protected void
protected URI
getEndpointURL
(org.opensaml.messaging.context.MessageContext messageContext) Gets the response URL from the message context.org.apache.velocity.app.VelocityEngine
Get the VelocityEngine instance.Get the Velocity template id.protected Element
marshallMessage
(org.opensaml.core.xml.XMLObject message) Helper method that marshalls the given message.protected void
populateVelocityContext
(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 void
postEncode
(org.opensaml.messaging.context.MessageContext messageContext, String endpointURL) void
setVelocityEngine
(org.apache.velocity.app.VelocityEngine newVelocityEngine) Set the VelocityEngine instance.void
setVelocityTemplateId
(String newVelocityTemplateId) Set the Velocity template id.Methods inherited from class org.opensaml.messaging.encoder.AbstractMessageEncoder
encode, getMessageContext, prepareContext, setMessageContext
Methods inherited from class net.shibboleth.utilities.java.support.component.AbstractInitializableComponent
destroy, initialize, isDestroyed, isInitialized
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface net.shibboleth.utilities.java.support.component.DestructableComponent
destroy, isDestroyed
Methods inherited from interface net.shibboleth.utilities.java.support.component.InitializableComponent
initialize, isInitialized
-
Field Details
-
DEFAULT_TEMPLATE_ID
Default template ID.- See Also:
-
-
Constructor Details
-
Pac4jHTTPPostEncoder
-
-
Method Details
-
doDestroy
protected void doDestroy()- Overrides:
doDestroy
in classorg.opensaml.messaging.encoder.AbstractMessageEncoder
-
doInitialize
protected void doInitialize() throws net.shibboleth.utilities.java.support.component.ComponentInitializationException- Overrides:
doInitialize
in classorg.opensaml.messaging.encoder.AbstractMessageEncoder
- Throws:
net.shibboleth.utilities.java.support.component.ComponentInitializationException
-
doEncode
protected void doEncode() throws org.opensaml.messaging.encoder.MessageEncodingException- Specified by:
doEncode
in 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
-