Package io.quarkus.oidc.runtime
Class DefaultTokenIntrospectionUserInfoCache
java.lang.Object
io.quarkus.oidc.runtime.DefaultTokenIntrospectionUserInfoCache
- All Implemented Interfaces:
TokenIntrospectionCache,UserInfoCache
public class DefaultTokenIntrospectionUserInfoCache
extends Object
implements TokenIntrospectionCache, UserInfoCache
Default TokenIntrospection and UserInfo Cache implementation.
A single cache entry can keep TokenIntrospection and/or UserInfo.
In most cases it is the opaque bearer access tokens which are introspected but the code flow access tokens can also be introspected if they have the roles claims.
In either case, if a remote request to fetch UserInfo is required then it will be the same access token which has been introspected which will be used to request UserInfo.
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) final MemoryCache<io.quarkus.oidc.runtime.DefaultTokenIntrospectionUserInfoCache.CacheEntry> -
Constructor Summary
ConstructorsConstructorDescriptionDefaultTokenIntrospectionUserInfoCache(OidcConfig oidcConfig, io.vertx.core.Vertx vertx) -
Method Summary
Modifier and TypeMethodDescriptionio.smallrye.mutiny.Uni<Void>addIntrospection(String token, TokenIntrospection introspection, OidcTenantConfig oidcTenantConfig, OidcRequestContext<Void> requestContext) Add a newTokenIntrospectionresult to the cache.io.smallrye.mutiny.Uni<Void>addUserInfo(String token, UserInfo userInfo, OidcTenantConfig oidcTenantConfig, OidcRequestContext<Void> requestContext) Add a newUserInfoto the cache.voidintio.smallrye.mutiny.Uni<TokenIntrospection>getIntrospection(String token, OidcTenantConfig oidcConfig, OidcRequestContext<TokenIntrospection> requestContext) Get the cachedTokenIntrospectionresult.io.smallrye.mutiny.Uni<UserInfo>getUserInfo(String token, OidcTenantConfig oidcConfig, OidcRequestContext<UserInfo> requestContext) Get the cachedUserInfo.(package private) voidshutdown(ShutdownEvent event, io.vertx.core.Vertx vertx)
-
Field Details
-
cache
-
-
Constructor Details
-
DefaultTokenIntrospectionUserInfoCache
-
-
Method Details
-
addIntrospection
public io.smallrye.mutiny.Uni<Void> addIntrospection(String token, TokenIntrospection introspection, OidcTenantConfig oidcTenantConfig, OidcRequestContext<Void> requestContext) Description copied from interface:TokenIntrospectionCacheAdd a newTokenIntrospectionresult to the cache.- Specified by:
addIntrospectionin interfaceTokenIntrospectionCache- Parameters:
token- the token which has been introspectedintrospection- the token introspection resultoidcTenantConfig- the tenant configurationrequestContext- the request context which can be used to run the blocking tasks
-
getIntrospection
public io.smallrye.mutiny.Uni<TokenIntrospection> getIntrospection(String token, OidcTenantConfig oidcConfig, OidcRequestContext<TokenIntrospection> requestContext) Description copied from interface:TokenIntrospectionCacheGet the cachedTokenIntrospectionresult.- Specified by:
getIntrospectionin interfaceTokenIntrospectionCache- Parameters:
token- the token which has to be introspectedoidcConfig- the tenant configurationrequestContext- the request context which can be used to run the blocking tasks
-
addUserInfo
public io.smallrye.mutiny.Uni<Void> addUserInfo(String token, UserInfo userInfo, OidcTenantConfig oidcTenantConfig, OidcRequestContext<Void> requestContext) Description copied from interface:UserInfoCacheAdd a newUserInfoto the cache.- Specified by:
addUserInfoin interfaceUserInfoCache- Parameters:
token- the token which was used to getUserInfouserInfo-UserInfooidcTenantConfig- the tenant configurationrequestContext- the request context which can be used to run the blocking tasks
-
getUserInfo
public io.smallrye.mutiny.Uni<UserInfo> getUserInfo(String token, OidcTenantConfig oidcConfig, OidcRequestContext<UserInfo> requestContext) Description copied from interface:UserInfoCacheGet the cachedUserInfo.- Specified by:
getUserInfoin interfaceUserInfoCache- Parameters:
token- the token which will be used to get newUserInfoif noUserInfois cached. Effectively this token is a cache key which has to be stored whenUserInfoCache.addUserInfo(String, UserInfo, OidcTenantConfig, AddUserInfoRequestContext)is called.oidcConfig- the tenant configurationrequestContext- the request context which can be used to run the blocking tasks
-
clearCache
public void clearCache() -
getCacheSize
public int getCacheSize() -
shutdown
-