Package org.pac4j.saml.transport
Class Pac4jHTTPRedirectDeflateEncoder
- java.lang.Object
-
- net.shibboleth.utilities.java.support.component.AbstractInitializableComponent
-
- org.opensaml.messaging.encoder.AbstractMessageEncoder
-
- org.pac4j.saml.transport.Pac4jHTTPRedirectDeflateEncoder
-
- 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 Pac4jHTTPRedirectDeflateEncoder extends org.opensaml.messaging.encoder.AbstractMessageEncoderPac4j implementation extending directly theAbstractMessageEncoderas 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
-
-
Constructor Summary
Constructors Constructor Description Pac4jHTTPRedirectDeflateEncoder(Pac4jSAMLResponse responseAdapter, boolean isAuthnRequestSigned)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.lang.StringbuildRedirectURL(org.opensaml.messaging.context.MessageContext messageContext, java.lang.String endpoint, java.lang.String message)Builds the URL to redirect the client to.protected voiddoEncode()protected voiddoInitialize()protected java.lang.StringgenerateSignature(org.opensaml.security.credential.Credential signingCredential, java.lang.String algorithmURI, java.lang.String queryString)Generates the signature over the query string.protected java.net.URIgetEndpointURL(org.opensaml.messaging.context.MessageContext messageContext)Gets the response URL from the message context.protected java.lang.StringgetSignatureAlgorithmURI(org.opensaml.xmlsec.SignatureSigningParameters signingParameters)Gets the signature algorithm URI to use.protected org.w3c.dom.ElementmarshallMessage(org.opensaml.core.xml.XMLObject message)Helper method that marshalls the given message.protected voidremoveSignature(org.opensaml.saml.common.SAMLObject message)Removes the signature from the protocol message.-
Methods inherited from class org.opensaml.messaging.encoder.AbstractMessageEncoder
doDestroy, 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
-
-
-
-
Constructor Detail
-
Pac4jHTTPRedirectDeflateEncoder
public Pac4jHTTPRedirectDeflateEncoder(Pac4jSAMLResponse responseAdapter, boolean isAuthnRequestSigned)
-
-
Method Detail
-
doEncode
protected void doEncode() throws org.opensaml.messaging.encoder.MessageEncodingException- Specified by:
doEncodein classorg.opensaml.messaging.encoder.AbstractMessageEncoder- Throws:
org.opensaml.messaging.encoder.MessageEncodingException
-
doInitialize
protected void doInitialize() throws net.shibboleth.utilities.java.support.component.ComponentInitializationException- Overrides:
doInitializein classorg.opensaml.messaging.encoder.AbstractMessageEncoder- Throws:
net.shibboleth.utilities.java.support.component.ComponentInitializationException
-
getEndpointURL
protected java.net.URI getEndpointURL(org.opensaml.messaging.context.MessageContext messageContext) throws org.opensaml.messaging.encoder.MessageEncodingExceptionGets 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
-
removeSignature
protected void removeSignature(org.opensaml.saml.common.SAMLObject message)
Removes the signature from the protocol message.- Parameters:
message- current message context
-
marshallMessage
protected org.w3c.dom.Element marshallMessage(org.opensaml.core.xml.XMLObject message) throws org.opensaml.messaging.encoder.MessageEncodingExceptionHelper 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
-
buildRedirectURL
protected java.lang.String buildRedirectURL(org.opensaml.messaging.context.MessageContext messageContext, java.lang.String endpoint, java.lang.String message) throws org.opensaml.messaging.encoder.MessageEncodingExceptionBuilds the URL to redirect the client to.- Parameters:
messageContext- current message contextendpoint- endpoint URL to send encoded message tomessage- Deflated and Base64 encoded message- Returns:
- URL to redirect client to
- Throws:
org.opensaml.messaging.encoder.MessageEncodingException- thrown if the SAML message is neither a RequestAbstractType or Response
-
getSignatureAlgorithmURI
protected java.lang.String getSignatureAlgorithmURI(org.opensaml.xmlsec.SignatureSigningParameters signingParameters) throws org.opensaml.messaging.encoder.MessageEncodingExceptionGets the signature algorithm URI to use.- Parameters:
signingParameters- the signing parameters to use- Returns:
- signature algorithm to use with the associated signing credential
- Throws:
org.opensaml.messaging.encoder.MessageEncodingException- thrown if the algorithm URI is not supplied explicitly and could not be derived from the supplied credential
-
generateSignature
protected java.lang.String generateSignature(org.opensaml.security.credential.Credential signingCredential, java.lang.String algorithmURI, java.lang.String queryString) throws org.opensaml.messaging.encoder.MessageEncodingExceptionGenerates the signature over the query string.- Parameters:
signingCredential- credential that will be used to sign query stringalgorithmURI- algorithm URI of the signing credentialqueryString- query string to be signed- Returns:
- base64 encoded signature of query string
- Throws:
org.opensaml.messaging.encoder.MessageEncodingException- there is an error computing the signature
-
-