Class CachingClientCredentialsFlow

java.lang.Object
org.apache.juneau.rest.server.auth.oauth.CachingClientCredentialsFlow

Server-side caching decorator layering an optional TokenCache over the role-neutral OAuthClientCredentialsFlow.

The neutral flow performs the RFC 6749 §4.4 client-credentials token acquisition; this decorator adds the server-side (clientId, scope)-keyed cache so repeat callers within the cache window reuse the token rather than hitting the IdP on each call. When no cache is configured the decorator simply delegates to the neutral flow.

Usage

var token = CachingClientCredentialsFlow.create() .tokenEndpoint(URI.create("https://idp.example.com/oauth2/token")) .clientId("worker-service") .clientSecret("...") .scope("read:orders") .tokenCache(BoundedLruTokenCache.create()) .build() .acquire();

Since:
10.0.0