in meecrowave-oauth2-minimal/src/main/java/org/apache/meecrowave/oauth2/configuration/JCacheConfigurer.java [60:102]
public void doSetup(final OAuth2Options options) {
if (!options.getProvider().startsWith("jcache")) {
return;
}
provider = Caching.getCachingProvider();
final File file = new File(options.getJcacheConfigUri());
URI configFileURI = file.isFile() ? file.toURI() : null;
if (configFileURI == null) {
try {
configFileURI = getClasspathResourceURL(options.getJcacheConfigUri(), JCacheOAuthDataProvider.class, bus).toURI();
} catch (final Exception ex) {
configFileURI = provider.getDefaultURI();
}
}
cacheManager = provider.getCacheManager(configFileURI, Thread.currentThread().getContextClassLoader());
try {
cacheManager.createCache(
JCacheOAuthDataProvider.CLIENT_CACHE_KEY,
configure(new MutableConfiguration<String, Client>().setTypes(String.class, Client.class), options));
if (!options.isJcacheStoreJwtKeyOnly()/* && options.isUseJwtFormatForAccessTokens()*/) {
cacheManager.createCache(
JCacheOAuthDataProvider.ACCESS_TOKEN_CACHE_KEY,
configure(new MutableConfiguration<String, ServerAccessToken>().setTypes(String.class, ServerAccessToken.class), options));
} else {
cacheManager.createCache(
JCacheOAuthDataProvider.ACCESS_TOKEN_CACHE_KEY,
configure(new MutableConfiguration<String, String>().setTypes(String.class, String.class), options));
}
cacheManager.createCache(
JCacheOAuthDataProvider.REFRESH_TOKEN_CACHE_KEY,
configure(new MutableConfiguration<String, RefreshToken>().setTypes(String.class, RefreshToken.class), options));
if (options.isAuthorizationCodeSupport()) {
cacheManager.createCache(
JCacheCodeDataProvider.CODE_GRANT_CACHE_KEY,
configure(new MutableConfiguration<String, ServerAuthorizationCodeGrant>().setTypes(String.class, ServerAuthorizationCodeGrant.class), options));
}
} catch (final CacheException ce) {
// already created
}
}