Class SignJWTHandler
java.lang.Object
net.shibboleth.shared.component.AbstractInitializableComponent
org.opensaml.messaging.handler.AbstractMessageHandler
net.shibboleth.oidc.security.impl.SignJWTHandler
- All Implemented Interfaces:
Component,DestructableComponent,InitializableComponent,MessageHandler
Message handler that signs a JWT and sets it back to the message context via an update consumer.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate Function<MessageContext,JWTClaimsSet> Strategy used to locate the payload to encrypt.private JWTClaimsSetThe stashed claims to sign.private BiConsumer<JWT,MessageContext> A consumer that takes the Signed JWT and updates the correct object inside the MessageContext.private final org.slf4j.LoggerClass logger.private StringA friendly name to log as the subject of signing.Strategy used to locate theSecurityParametersContextto use for signing.private JWSTokenSignerThe signing engine used to sign the JWT claims set.private Function<MessageContext,String> Strategy used to locate the optional "typ" header to insert while signing. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidprotected voiddoInvoke(MessageContext messageContext) protected booleandoPreInvoke(MessageContext messageContext) private voidLog (on trace) the JWT.voidSet the strategy used to locate theJWTClaimsSetto sign.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 signing.voidSet the strategy used to locate theSecurityParametersContextto use.voidsetTypeHeader(String type) Sets the value to be inserted as a "typ" header for the JWS.voidsetTypeHeaderLookupStrategy(Function<MessageContext, String> strategy) Sets the strategy used to locate the optional "typ" header to insert while signingMethods 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. -
jwtUpdateConsumer
A consumer that takes the Signed JWT and updates the correct object inside the MessageContext. -
claimsToSignLookupStrategy
Strategy used to locate the payload to encrypt. -
jwtClaimSetToSign
The stashed claims to sign. -
typeHeaderLookupStrategy
Strategy used to locate the optional "typ" header to insert while signing. -
logName
A friendly name to log as the subject of signing. -
signer
The signing engine used to sign the JWT claims set.
-
-
Constructor Details
-
SignJWTHandler
public SignJWTHandler()Constructor.
-
-
Method Details
-
setLogName
Set the friendly name to log as the subject of signing.- Parameters:
name- the friendly name
-
doInitialize
- Overrides:
doInitializein classAbstractInitializableComponent- Throws:
ComponentInitializationException
-
setClaimsToSignLookupStrategy
Set the strategy used to locate theJWTClaimsSetto sign.- Parameters:
strategy- the strategy
-
setJwtUpdateConsumer
Set the consumer used to update the MessageContext with the supplied EncryptedJWT.- Parameters:
consumer- the consumer
-
setTypeHeader
Sets the value to be inserted as a "typ" header for the JWS.- Parameters:
type- header value
-
setSecurityParametersLookupStrategy
public void setSecurityParametersLookupStrategy(@Nonnull Function<MessageContext, SecurityParametersContext> strategy) Set the strategy used to locate theSecurityParametersContextto use.- Parameters:
strategy- lookup strategy
-
setTypeHeaderLookupStrategy
Sets the strategy used to locate the optional "typ" header to insert while signing- Parameters:
strategy- lookup strategy- Since:
- 3.1.0
-
doPreInvoke
protected boolean doPreInvoke(@Nonnull MessageContext messageContext) throws MessageHandlerException - Overrides:
doPreInvokein classAbstractMessageHandler- Throws:
MessageHandlerException
-
doInvoke
- Specified by:
doInvokein classAbstractMessageHandler- Throws:
MessageHandlerException
-
logJWT
Log (on trace) the JWT.- Parameters:
jwt- the JWT to log.
-