Class SetRefreshTokenToResponseContext
java.lang.Object
net.shibboleth.shared.component.AbstractInitializableComponent
org.opensaml.profile.action.AbstractProfileAction
org.opensaml.profile.action.AbstractConditionalProfileAction
net.shibboleth.idp.profile.AbstractProfileAction
net.shibboleth.idp.plugin.oidc.op.profile.impl.AbstractOIDCResponseAction
net.shibboleth.idp.plugin.oidc.op.profile.impl.SetRefreshTokenToResponseContext
- All Implemented Interfaces:
Component,DestructableComponent,InitializableComponent,ProfileAction,Aware,MessageSource,MessageSourceAware,Action
Action that creates a Refresh Token, and sets it to work context
OIDCAuthenticationResponseContext.getRefreshToken() located under
InOutOperationContext.getOutboundMessageContext(). The refresh_token is created only if the request contains
offline_access - scope.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final DataSealerData sealer for handling access token.private Predicate<ProfileRequestContext>Strategy used to determine whether to revoke refresh tokens once they're used.private IdentifierGenerationStrategyThe generator to use.Strategy used to locate theIdentifierGenerationStrategyto use.private org.slf4j.LoggerClass logger.private BiFunction<ProfileRequestContext,Map<String, Object>, Map<String, Object>> The strategy used for manipulating the token claims set.private DurationRefresh Token chain lifetime.private Function<ProfileRequestContext,Duration> Strategy used to obtain the refresh token chain lifetime.The strategies used for serializing refresh token claims set, key referring to the refresh token type.private DurationRefresh Token timeout.private Function<ProfileRequestContext,Duration> Strategy used to obtain the refresh token timeout.private StringRefresh Token type.private Function<ProfileRequestContext,String> Strategy used to obtain the refresh token type to issue.private RevocationCacheMessage revocation cache instance to use.private TokenClaimsSetAuthorize Code / Refresh Token the refresh token will be based on.private Function<ProfileRequestContext,BiFunction<ProfileRequestContext, Map<String, Object>, Map<String, Object>>> Lookup function to supply strategy bi-function for manipulating token claims set.private Function<JWTClaimsSet,Duration> Lookup function to supply token revocation lifetime.private booleanThe xmlSafe-flag passed to the identifier generator. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected InstantcalculateChainExp(TokenClaimsSet tokenClaimsSet) Calculates the chain expiration time by taking the closest from the existing item in the claims set (if exists) and the value calculated via current profile configuration.protected voiddoExecute(ProfileRequestContext profileRequestContext) protected voidprotected booleandoPreExecute(ProfileRequestContext profileRequestContext) protected InstantgetExistingChainExp(TokenClaimsSet tokenClaimsSet) Get the possibly existing chain expiration instant from the claims set.voidSet the condition used to determine whether to revoke refresh tokens once they're used.voidsetIdentifierGeneratorLookupStrategy(Function<ProfileRequestContext, IdentifierGenerationStrategy> strategy) Set the strategy used to locate theIdentifierGenerationStrategyto use.voidSet the strategy used to obtain the refresh token chain lifetime.voidsetRefreshTokenSerializationStrategies(Map<String, BiFunction<ProfileRequestContext, RefreshTokenClaimsSet, String>> strategies) Set the strategies used for serializing refresh token claims set, key referring to the refresh token type.voidSet the strategy used to obtain the refresh token timeout.voidSet a lookup strategy to obtain the refresh token type to issue.voidSet the revocation cache instance to use.voidsetTokenClaimsSetManipulationStrategyLookupStrategy(Function<ProfileRequestContext, BiFunction<ProfileRequestContext, Map<String, Object>, Map<String, Object>>> strategy) Set the lookup function to supply strategy bi-function for manipulating token claims set.voidSet a lookup strategy for the token revocation lifetime.voidsetXmlSafeIdentifier(boolean flag) Set the xmlSafe-flag passed to the identifier generatorMethods inherited from class net.shibboleth.idp.plugin.oidc.op.profile.impl.AbstractOIDCResponseAction
getMetadataContext, getOidcResponseContextMethods inherited from class net.shibboleth.idp.profile.AbstractProfileAction
doExecute, execute, getBean, getBean, getMessage, getMessage, getMessage, getParameter, getParameter, getProfileContextLookupStrategy, getRequestContext, getResult, setMessageSource, setProfileContextLookupStrategyMethods inherited from class org.opensaml.profile.action.AbstractConditionalProfileAction
getActivationCondition, setActivationConditionMethods inherited from class org.opensaml.profile.action.AbstractProfileAction
doPostExecute, doPostExecute, ensureHttpServletRequest, ensureHttpServletResponse, execute, getHttpServletRequest, getHttpServletRequestSupplier, getHttpServletResponse, getHttpServletResponseSupplier, getLogPrefix, isPreExecuteCalled, setHttpServletRequestSupplier, setHttpServletResponseSupplierMethods 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 org.slf4j.Logger logClass logger. -
dataSealer
Data sealer for handling access token. -
revocationCache
Message revocation cache instance to use. -
refreshTokenChainLifetimeLookupStrategy
Strategy used to obtain the refresh token chain lifetime. -
refreshTokenTimeoutLookupStrategy
Strategy used to obtain the refresh token timeout. -
tokenClaimsSetManipulationStrategyLookupStrategy
@Nonnull private Function<ProfileRequestContext,BiFunction<ProfileRequestContext, tokenClaimsSetManipulationStrategyLookupStrategyMap<String, Object>, Map<String, Object>>> Lookup function to supply strategy bi-function for manipulating token claims set. -
manipulationStrategy
@Nullable private BiFunction<ProfileRequestContext,Map<String, manipulationStrategyObject>, Map<String, Object>> The strategy used for manipulating the token claims set. -
idGeneratorLookupStrategy
@Nonnull private Function<ProfileRequestContext,IdentifierGenerationStrategy> idGeneratorLookupStrategyStrategy used to locate theIdentifierGenerationStrategyto use. -
enforceRefreshTokenRotationCondition
Strategy used to determine whether to revoke refresh tokens once they're used. -
tokenRevocationLifetimeLookupStrategy
Lookup function to supply token revocation lifetime. -
refreshTokenTypeLookupStrategy
Strategy used to obtain the refresh token type to issue. -
refreshTokenSerializationStrategies
@Nonnull private Map<String,BiFunction<ProfileRequestContext, refreshTokenSerializationStrategiesRefreshTokenClaimsSet, String>> The strategies used for serializing refresh token claims set, key referring to the refresh token type. -
tokenClaimsSet
Authorize Code / Refresh Token the refresh token will be based on. -
refreshTokenChainLifetime
Refresh Token chain lifetime. -
refreshTokenTimeout
Refresh Token timeout. -
idGenerator
The generator to use. -
refreshTokenType
Refresh Token type. -
xmlSafeIdentifier
private boolean xmlSafeIdentifierThe xmlSafe-flag passed to the identifier generator.
-
-
Constructor Details
-
Method Details
-
setRevocationCache
Set the revocation cache instance to use.- Parameters:
cache- The revocationCache to set.
-
setRefreshTokenChainLifetimeLookupStrategy
public void setRefreshTokenChainLifetimeLookupStrategy(@Nonnull Function<ProfileRequestContext, Duration> strategy) Set the strategy used to obtain the refresh token chain lifetime.- Parameters:
strategy- lookup strategy
-
setRefreshTokenTimeoutLookupStrategy
public void setRefreshTokenTimeoutLookupStrategy(@Nonnull Function<ProfileRequestContext, Duration> strategy) Set the strategy used to obtain the refresh token timeout.- Parameters:
strategy- lookup strategy
-
setTokenClaimsSetManipulationStrategyLookupStrategy
public void setTokenClaimsSetManipulationStrategyLookupStrategy(@Nonnull Function<ProfileRequestContext, BiFunction<ProfileRequestContext, Map<String, Object>, Map<String, Object>>> strategy) Set the lookup function to supply strategy bi-function for manipulating token claims set.- Parameters:
strategy- What to set
-
setIdentifierGeneratorLookupStrategy
public void setIdentifierGeneratorLookupStrategy(@Nonnull Function<ProfileRequestContext, IdentifierGenerationStrategy> strategy) Set the strategy used to locate theIdentifierGenerationStrategyto use.- Parameters:
strategy- lookup strategy
-
setEnforceRefreshTokenRotationCondition
public void setEnforceRefreshTokenRotationCondition(@Nonnull Predicate<ProfileRequestContext> condition) Set the condition used to determine whether to revoke refresh tokens once they're used.- Parameters:
condition- condition to apply
-
setTokenRevocationLifetimeLookupStrategy
public void setTokenRevocationLifetimeLookupStrategy(@Nullable Function<JWTClaimsSet, Duration> strategy) Set a lookup strategy for the token revocation lifetime.- Parameters:
strategy- What to set.
-
setRefreshTokenTypeLookupStrategy
public void setRefreshTokenTypeLookupStrategy(@Nonnull Function<ProfileRequestContext, String> strategy) Set a lookup strategy to obtain the refresh token type to issue.- Parameters:
strategy- What to set.
-
setRefreshTokenSerializationStrategies
public void setRefreshTokenSerializationStrategies(@Nonnull Map<String, BiFunction<ProfileRequestContext, RefreshTokenClaimsSet, String>> strategies) Set the strategies used for serializing refresh token claims set, key referring to the refresh token type.- Parameters:
strategies- What to set.
-
setXmlSafeIdentifier
public void setXmlSafeIdentifier(boolean flag) Set the xmlSafe-flag passed to the identifier generator- Parameters:
flag- xmlSafe-flag
-
doInitialize
- Overrides:
doInitializein classAbstractInitializableComponent- Throws:
ComponentInitializationException
-
doPreExecute
- Overrides:
doPreExecutein classAbstractOIDCResponseAction
-
doExecute
- Overrides:
doExecutein classAbstractProfileAction
-
getExistingChainExp
Get the possibly existing chain expiration instant from the claims set.- Parameters:
tokenClaimsSet- the claims set input- Returns:
- the existing value if exists, null otherwise
-
calculateChainExp
Calculates the chain expiration time by taking the closest from the existing item in the claims set (if exists) and the value calculated via current profile configuration.- Parameters:
tokenClaimsSet- The claims set to operate on. If it doesn't contain authentication time, the chain expiration time is set to now.- Returns:
- the instant to be used as the chain expiration time
-