Class NimbusResponseEncoder
java.lang.Object
net.shibboleth.shared.component.AbstractInitializableComponent
org.opensaml.messaging.encoder.AbstractMessageEncoder
org.opensaml.messaging.encoder.servlet.AbstractHttpServletResponseMessageEncoder
net.shibboleth.idp.plugin.oidc.op.encoding.impl.NimbusResponseEncoder
- All Implemented Interfaces:
Component,DestructableComponent,InitializableComponent,UnmodifiableComponent,MessageEncoder,HttpServletResponseMessageEncoder
A message encodes that encodes the Nimbus
Response in the message context inside the attached
HttpServletResponse.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate StringDigesterCSP digester for generating CSP hashes.private IdentifierGenerationStrategyCSP nonce generator.static final StringDefault template ID for using FORM POST response mode.private com.fasterxml.jackson.databind.ObjectMapperObject mapper used for pretty-printing JSON response.private org.apache.velocity.app.VelocityEngineVelocity engine used to evaluate the template when using FORM POST response mode.private StringID of the Velocity template used when using FORM POST response mode.Fields inherited from class org.opensaml.messaging.encoder.AbstractMessageEncoder
BASE_PROTOCOL_MESSAGE_LOGGER_CATEGORY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voiddoEncode()private org.apache.velocity.VelocityContextdoPostEncode(com.nimbusds.oauth2.sdk.AuthorizationResponse message) Set response message to FORM POST velocity context.private booleanimpliesFormPost(Object response) Whether we should use FORM POST response encoding.protected StringserializeMessageForLogging(Object message) voidsetCSPDigester(StringDigester digester) Sets aStringDigesterto use in computing CSP digests in views.voidSets anIdentifierGenerationStrategyto use in computing CSP nonces in views.voidsetObjectMapper(com.fasterxml.jackson.databind.ObjectMapper mapper) Set the object mapper used for pretty-printing JSON in the request.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.servlet.AbstractHttpServletResponseMessageEncoder
doInitialize, getHttpServletResponse, getHttpServletResponseSupplier, setHttpServletResponseSupplierMethods inherited from class org.opensaml.messaging.encoder.AbstractMessageEncoder
encode, getMessageContext, getMessageToLog, getProtocolMessageLogger, getProtocolMessageLoggerSubCategory, logEncodedMessage, prepareContext, setMessageContext, setProtocolMessageLoggerSubCategoryMethods inherited from class net.shibboleth.shared.component.AbstractInitializableComponent
checkComponentActive, checkSetterPreconditions, destroy, doDestroy, 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, isInitializedMethods inherited from interface org.opensaml.messaging.encoder.MessageEncoder
encode, prepareContext, setMessageContext
-
Field Details
-
DEFAULT_TEMPLATE_ID
Default template ID for using FORM POST response mode.- See Also:
-
velocityEngine
@Nullable private org.apache.velocity.app.VelocityEngine velocityEngineVelocity engine used to evaluate the template when using FORM POST response mode. -
velocityTemplateId
ID of the Velocity template used when using FORM POST response mode. -
objectMapper
Object mapper used for pretty-printing JSON response. -
cspDigester
CSP digester for generating CSP hashes. -
cspNonceGenerator
CSP nonce generator.
-
-
Constructor Details
-
NimbusResponseEncoder
public NimbusResponseEncoder()Constructor.
-
-
Method Details
-
setVelocityTemplateId
Set the Velocity template id.Defaults to
DEFAULT_TEMPLATE_ID.- Parameters:
newVelocityTemplateId- the new Velocity template id
-
setVelocityEngine
public void setVelocityEngine(org.apache.velocity.app.VelocityEngine newVelocityEngine) Set the VelocityEngine instance.- Parameters:
newVelocityEngine- the new VelocityEngine instane
-
setObjectMapper
public void setObjectMapper(@Nonnull com.fasterxml.jackson.databind.ObjectMapper mapper) Set the object mapper used for pretty-printing JSON in the request.- Parameters:
mapper- What to set.- Since:
- 4.1.0
-
impliesFormPost
Whether we should use FORM POST response encoding.- Parameters:
response- response message.- Returns:
- true if DORM POST should be used.
-
doPostEncode
private org.apache.velocity.VelocityContext doPostEncode(@Nonnull com.nimbusds.oauth2.sdk.AuthorizationResponse message) Set response message to FORM POST velocity context.- Parameters:
message- response message.- Returns:
- response message as velocity context.
-
doEncode
- Specified by:
doEncodein classAbstractMessageEncoder- Throws:
MessageEncodingException
-
serializeMessageForLogging
- Overrides:
serializeMessageForLoggingin classAbstractMessageEncoder
-