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
Modifier and TypeFieldDescription(package private) final MemoryCache<io.quarkus.oidc.runtime.DefaultTokenIntrospectionUserInfoCache.CacheEntry>
-
Constructor Summary
ConstructorDescriptionDefaultTokenIntrospectionUserInfoCache
(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 newTokenIntrospection
result to the cache.io.smallrye.mutiny.Uni<Void>
addUserInfo
(String token, UserInfo userInfo, OidcTenantConfig oidcTenantConfig, OidcRequestContext<Void> requestContext) Add a newUserInfo
to the cache.void
int
io.smallrye.mutiny.Uni<TokenIntrospection>
getIntrospection
(String token, OidcTenantConfig oidcConfig, OidcRequestContext<TokenIntrospection> requestContext) Get the cachedTokenIntrospection
result.io.smallrye.mutiny.Uni<UserInfo>
getUserInfo
(String token, OidcTenantConfig oidcConfig, OidcRequestContext<UserInfo> requestContext) Get the cachedUserInfo
.(package private) void
shutdown
(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:TokenIntrospectionCache
Add a newTokenIntrospection
result to the cache.- Specified by:
addIntrospection
in 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:TokenIntrospectionCache
Get the cachedTokenIntrospection
result.- Specified by:
getIntrospection
in 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:UserInfoCache
Add a newUserInfo
to the cache.- Specified by:
addUserInfo
in interfaceUserInfoCache
- Parameters:
token
- the token which was used to getUserInfo
userInfo
-UserInfo
oidcTenantConfig
- 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:UserInfoCache
Get the cachedUserInfo
.- Specified by:
getUserInfo
in interfaceUserInfoCache
- Parameters:
token
- the token which will be used to get newUserInfo
if noUserInfo
is 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
-