Class DefaultJwtRefreshTokenSerializationFunction
java.lang.Object
net.shibboleth.shared.component.AbstractInitializableComponent
net.shibboleth.idp.plugin.oidc.op.profile.logic.DefaultJwtRefreshTokenSerializationFunction
- All Implemented Interfaces:
BiFunction<ProfileRequestContext,,RefreshTokenClaimsSet, String> Component,DestructableComponent,InitializableComponent
public class DefaultJwtRefreshTokenSerializationFunction
extends AbstractInitializableComponent
implements BiFunction<ProfileRequestContext,RefreshTokenClaimsSet,String>
Default implementation for serializing the refresh token claims set into a JWT refresh token.
The JWT refresh token contains the following claims:
- iss - The issuer value fetched from
TokenClaimsSet.getIssuer() - aud - The audience value fetched from
audienceLookupStrategy - iat - The issued at value fetched from
TokenClaimsSet.getIssuedAt() - exp - The expiration value fetched from
TokenClaimsSet.getExp() - jti - The token identifier value fetched from
TokenClaimsSet.getID() - client_id - The client ID value fetched from
TokenClaimsSet.getClientID() - for_op - the internal state information for OP's use (the sealed refresh token claims set)
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate Function<ProfileRequestContext,String> Strategy to find the audience value from the context.private DataSealerData sealer for sealing private parts of the refresh token.private final org.slf4j.LoggerClass logger.private com.fasterxml.jackson.databind.ObjectMapperObject mapper used for pretty-printing JWT contents.private org.slf4j.LoggerUsed to log protocol messages.Strategy used to look up theSecurityParametersContextto set the parameters for.(package private) MessageHandlerHandler that resolves and populatesSignatureSigningParameters.Strategy used to lookup the type header value for the JWT. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionapply(ProfileRequestContext profileRequestContext, RefreshTokenClaimsSet claimsSet) protected com.nimbusds.jwt.SignedJWTconstructJWT(RefreshTokenClaimsSet claimsSet, String audience, SignatureSigningParameters signingParameters, String typeHeader) Construct aSignedJWTwith the given input claims and signing parameters.protected voidvoidSet the audience lookup strategy.voidsetDataSealer(DataSealer sealer) Set the data sealer instance to use.voidsetObjectMapper(com.fasterxml.jackson.databind.ObjectMapper mapper) Set the object mapper used for pretty-printing JWT contents.voidsetSecurityParametersContextLookupStrategy(Function<ProfileRequestContext, SecurityParametersContext> strategy) Set the strategy used to look up theSecurityParametersContextto set the parameters for.voidSet the handler that resolves and populatesSignatureSigningParameters.voidsetTypeHeaderLookupStrategy(BiFunction<ProfileRequestContext, RefreshTokenClaimsSet, String> strategy) Set the strategy used to lookup the type header value for the JWT.Methods 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 java.util.function.BiFunction
andThen
-
Field Details
-
log
@Nonnull private final org.slf4j.Logger logClass logger. -
protocolMessageLog
@Nonnull private org.slf4j.Logger protocolMessageLogUsed to log protocol messages. -
dataSealer
Data sealer for sealing private parts of the refresh token. -
securityParametersContextLookupStrategy
@Nonnull private Function<ProfileRequestContext,SecurityParametersContext> securityParametersContextLookupStrategyStrategy used to look up theSecurityParametersContextto set the parameters for. -
signingParametersHandler
Handler that resolves and populatesSignatureSigningParameters. -
typeHeaderLookupStrategy
@NonnullAfterInit private BiFunction<ProfileRequestContext,RefreshTokenClaimsSet, typeHeaderLookupStrategyString> Strategy used to lookup the type header value for the JWT. -
audienceLookupStrategy
Strategy to find the audience value from the context. -
objectMapper
Object mapper used for pretty-printing JWT contents.
-
-
Constructor Details
-
DefaultJwtRefreshTokenSerializationFunction
public DefaultJwtRefreshTokenSerializationFunction()Constructor.
-
-
Method Details
-
setSecurityParametersContextLookupStrategy
public void setSecurityParametersContextLookupStrategy(@Nonnull Function<ProfileRequestContext, SecurityParametersContext> strategy) Set the strategy used to look up theSecurityParametersContextto set the parameters for.- Parameters:
strategy- What to set.
-
setSigningParametersHandler
Set the handler that resolves and populatesSignatureSigningParameters.- Parameters:
handler- What to set.
-
setTypeHeaderLookupStrategy
public void setTypeHeaderLookupStrategy(@Nonnull BiFunction<ProfileRequestContext, RefreshTokenClaimsSet, String> strategy) Set the strategy used to lookup the type header value for the JWT.- Parameters:
strategy- What to set.
-
setAudienceLookupStrategy
Set the audience lookup strategy.- Parameters:
strategy- the strategy.
-
setObjectMapper
public void setObjectMapper(@Nonnull com.fasterxml.jackson.databind.ObjectMapper mapper) Set the object mapper used for pretty-printing JWT contents.- Parameters:
mapper- What to set.
-
doInitialize
- Overrides:
doInitializein classAbstractInitializableComponent- Throws:
ComponentInitializationException
-
apply
@Nullable public String apply(@Nullable ProfileRequestContext profileRequestContext, @Nullable RefreshTokenClaimsSet claimsSet) - Specified by:
applyin interfaceBiFunction<ProfileRequestContext,RefreshTokenClaimsSet, String>
-
constructJWT
@Nullable protected com.nimbusds.jwt.SignedJWT constructJWT(@Nonnull RefreshTokenClaimsSet claimsSet, @Nonnull String audience, @Nonnull SignatureSigningParameters signingParameters, @Nullable String typeHeader) Construct aSignedJWTwith the given input claims and signing parameters.- Parameters:
claimsSet- The input for payloadaudience- The audience for the JWTsigningParameters- The signing parameterstypeHeader- The type header value for the JWT- Returns:
- A signed JWT, or null