Class ValidateGrant
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.AbstractOIDCRequestAction<com.nimbusds.oauth2.sdk.TokenRequest>
net.shibboleth.idp.plugin.oidc.op.profile.impl.AbstractOIDCTokenRequestAction
net.shibboleth.idp.plugin.oidc.op.profile.impl.AbstractOIDCTokenResponseAction
net.shibboleth.idp.plugin.oidc.op.profile.impl.ValidateGrant
- All Implemented Interfaces:
Component,DestructableComponent,InitializableComponent,ProfileAction,Aware,MessageSource,MessageSourceAware,Action
Action that validates an authorization grant.
A grant is valid if it is successfully unwrapped, parsed as a code or refresh token, is unexpired, was issued to the expected client and has not been used before (authz code) or the authz code used to produce it has not been revoked (refresh token).
The validated claims from the grant are stored to response context via
OIDCAuthenticationResponseContext.getAuthorizationGrantClaimsSet().
Note that the addition of support for the "client_credentials" grant type means that there may not in fact be a grant, or resulting claims set.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate Function<ProfileRequestContext,Duration> Lookup function to supply chain revocation lifetime.private Function<ProfileRequestContext,String> Strategy used to locate thumbprint of validated DPoP Proof JWT.private org.slf4j.LoggerClass logger.private DurationRefresh Token lifetime.private Function<ProfileRequestContext,Duration> Strategy used to obtain the refresh token lifetime.private Predicate<ProfileRequestContext>Predicate used to indicate whether refresh tokens are enabled.Strategy used to locate theRelyingPartyContextassociated with a givenProfileRequestContext.private ReplayCacheMessage replay cache instance to use.private RevocationCacheMessage revocation cache instance to use.private RelyingPartyContextThe RelyingPartyContext to operate on.private BiPredicate<ProfileRequestContext,com.nimbusds.jwt.JWTClaimsSet> Predicate used to indicate whether the authorization code or refresh token is revoked. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voiddoExecute(ProfileRequestContext profileRequestContext) protected voidprotected booleandoPreExecute(ProfileRequestContext profileRequestContext) protected booleanChecks if the client is a public client.protected booleanrevokeChain(String id, Duration lifetime) Revokes the token chain with the given id, optionally with a given lifetime.voidSet a lookup strategy for the chain revocation lifetime.voidSet the strategy used to locate the thumbprint of validated DPoP Proof JWT.voidSet the strategy used to obtain the refresh token chain lifetime.voidSet the predicate used to indicate whether refresh tokens are enabled.voidSet the strategy used to locate theRelyingPartyContextassociated with a givenProfileRequestContext.voidsetReplayCache(ReplayCache cache) Set the replay cache instance to use.voidSet the revocation cache instance to use.voidsetTokenRevocationCondition(BiPredicate<ProfileRequestContext, com.nimbusds.jwt.JWTClaimsSet> condition) Set the predicate used to indicate whether the authorization code or refresh token is revoked.Methods inherited from class net.shibboleth.idp.plugin.oidc.op.profile.impl.AbstractOIDCTokenResponseAction
getMetadataContext, getOidcResponseContextMethods inherited from class net.shibboleth.idp.plugin.oidc.op.profile.impl.AbstractOIDCTokenRequestAction
getTokenRequestMethods inherited from class net.shibboleth.idp.plugin.oidc.op.profile.impl.AbstractOIDCRequestAction
getRequestMethods 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. -
replayCache
Message replay cache instance to use. -
revocationCache
Message revocation cache instance to use. -
relyingPartyContextLookupStrategy
@Nonnull private Function<ProfileRequestContext,RelyingPartyContext> relyingPartyContextLookupStrategyStrategy used to locate theRelyingPartyContextassociated with a givenProfileRequestContext. -
refreshTokensEnabledPredicate
Predicate used to indicate whether refresh tokens are enabled. -
chainRevocationLifetimeLookupStrategy
Lookup function to supply chain revocation lifetime. -
refreshTokenChainLifetimeLookupStrategy
Strategy used to obtain the refresh token lifetime. -
dpopProofThumbprintLookupStrategy
Strategy used to locate thumbprint of validated DPoP Proof JWT. -
tokenRevocationCondition
@Nullable private BiPredicate<ProfileRequestContext,com.nimbusds.jwt.JWTClaimsSet> tokenRevocationConditionPredicate used to indicate whether the authorization code or refresh token is revoked. -
rpCtx
The RelyingPartyContext to operate on. -
refreshTokenChainLifetime
Refresh Token lifetime.
-
-
Constructor Details
-
ValidateGrant
public ValidateGrant()Constructor.
-
-
Method Details
-
setRelyingPartyContextLookupStrategy
public void setRelyingPartyContextLookupStrategy(@Nonnull Function<ProfileRequestContext, RelyingPartyContext> strategy) Set the strategy used to locate theRelyingPartyContextassociated with a givenProfileRequestContext.- Parameters:
strategy- strategy used to locate theRelyingPartyContextassociated with a givenProfileRequestContext
-
setRefreshTokensEnabledPredicate
Set the predicate used to indicate whether refresh tokens are enabled.- Parameters:
predicate- predicate used to indicate whether refresh tokens are enabled.
-
setReplayCache
Set the replay cache instance to use.- Parameters:
cache- The replayCache to set.
-
setRevocationCache
Set the revocation cache instance to use.- Parameters:
cache- The revocationCache to set.
-
setChainRevocationLifetimeLookupStrategy
public void setChainRevocationLifetimeLookupStrategy(@Nullable Function<ProfileRequestContext, Duration> strategy) Set a lookup strategy for the chain revocation lifetime.- Parameters:
strategy- What 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
-
setDpopProofThumbprintLookupStrategy
public void setDpopProofThumbprintLookupStrategy(@Nonnull Function<ProfileRequestContext, String> strategy) Set the strategy used to locate the thumbprint of validated DPoP Proof JWT.- Parameters:
strategy- lookup strategy- Since:
- 4.2.0
-
setTokenRevocationCondition
public void setTokenRevocationCondition(@Nullable BiPredicate<ProfileRequestContext, com.nimbusds.jwt.JWTClaimsSet> condition) Set the predicate used to indicate whether the authorization code or refresh token is revoked.- Parameters:
condition- token revocation condition- Since:
- 4.3.0
-
doInitialize
- Overrides:
doInitializein classAbstractInitializableComponent- Throws:
ComponentInitializationException
-
doPreExecute
- Overrides:
doPreExecutein classAbstractOIDCTokenResponseAction
-
doExecute
- Overrides:
doExecutein classAbstractProfileAction
-
isPublicClient
protected boolean isPublicClient()Checks if the client is a public client. If not metadata exists for the client, it's assumed to be confidential. The client is considered as confidential if its metadata doesn't specify "none" as the token endpoint authentication method.- Returns:
- true if the client is public, false otherwise.
-
revokeChain
Revokes the token chain with the given id, optionally with a given lifetime. If the given lifetime is null, the default lifetime set to theRevocationCacheis used.- Parameters:
id- The identifier to be revoked inRevocationCacheContexts.AUTHORIZATION_CODEcontext.lifetime- The lifetime for the revocation- Returns:
- The result returned by the
RevocationCache
-