Class EncryptJWTHandler
java.lang.Object
net.shibboleth.shared.component.AbstractInitializableComponent
org.opensaml.messaging.handler.AbstractMessageHandler
net.shibboleth.oidc.security.impl.EncryptJWTHandler
- All Implemented Interfaces:
Component,DestructableComponent,InitializableComponent,MessageHandler
A
MessageHandler that encrypts a JWT using the EncryptionParameters found in the
SecurityParametersContext. The Payload to encrypt is determined by lookup strategy.
A supplied consumer takes the EncryptedJWT and updates the correct object in the MessageContext.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate EncryptionParametersThe signature signing parameters.private BiConsumer<JWT,MessageContext> A consumer that takes the EncryptedJWT and updates the correct object inside the MessageContext.private final org.slf4j.LoggerClass logger.private StringA friendly name to log as the subject of encryption.private Function<MessageContext,Payload> Strategy used to locate the payload to encrypt.Strategy used to locate theSecurityParametersContextto use for signing. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidprotected voiddoInvoke(MessageContext messageContext) protected booleandoPreInvoke(MessageContext messageContext) private voidlogEncryption(String keyID, String alg, String enc) A convince method to log encryption parameters.voidsetJwtUpdateConsumer(BiConsumer<JWT, MessageContext> consumer) Set the consumer used to update the MessageContext with the supplied EncryptedJWT.voidsetLogName(String name) Set the friendly name to log as the subject of encryption.voidSet the strategy used to locate thePayloadto encrypt.voidSet the strategy used to locate theSecurityParametersContextto use.Methods inherited from class org.opensaml.messaging.handler.AbstractMessageHandler
doPostInvoke, doPostInvoke, getActivationCondition, getLogPrefix, invoke, isPreInvokeCalled, setActivationConditionMethods 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.InitializableComponent
initialize, isInitialized
-
Field Details
-
log
@Nonnull private final org.slf4j.Logger logClass logger. -
securityParametersLookupStrategy
@Nonnull private Function<MessageContext,SecurityParametersContext> securityParametersLookupStrategyStrategy used to locate theSecurityParametersContextto use for signing. -
payloadToEncryptLookupStrategy
Strategy used to locate the payload to encrypt. -
jwtUpdateConsumer
A consumer that takes the EncryptedJWT and updates the correct object inside the MessageContext. -
encryptionParameters
The signature signing parameters. -
logName
A friendly name to log as the subject of encryption.
-
-
Constructor Details
-
EncryptJWTHandler
public EncryptJWTHandler()Constructor.
-
-
Method Details
-
setLogName
Set the friendly name to log as the subject of encryption.- Parameters:
name- the friendly name
-
setJwtUpdateConsumer
Set the consumer used to update the MessageContext with the supplied EncryptedJWT.- Parameters:
consumer- the consumer
-
setPayloadToEncryptLookupStrategy
Set the strategy used to locate thePayloadto encrypt.- Parameters:
strategy- the strategy
-
setSecurityParametersLookupStrategy
public void setSecurityParametersLookupStrategy(@Nonnull Function<MessageContext, SecurityParametersContext> strategy) Set the strategy used to locate theSecurityParametersContextto use.- Parameters:
strategy- lookup strategy
-
doInitialize
- Overrides:
doInitializein classAbstractInitializableComponent- Throws:
ComponentInitializationException
-
doPreInvoke
protected boolean doPreInvoke(@Nonnull MessageContext messageContext) throws MessageHandlerException - Overrides:
doPreInvokein classAbstractMessageHandler- Throws:
MessageHandlerException
-
doInvoke
- Specified by:
doInvokein classAbstractMessageHandler- Throws:
MessageHandlerException
-
logEncryption
A convince method to log encryption parameters. Avoids some of the clutter in the calling methods.- Parameters:
keyID- the keyIDalg- the content encryption algorithmenc- the key management algorithm
-