use of org.keycloak.storage.client.ClientStorageProviderModel in project keycloak by keycloak.
the class ClientStorageTest method testDailyEviction.
@Test
public void testDailyEviction() {
testIsCached();
testingClient.server().run(session -> {
RealmModel realm = session.realms().getRealmByName("test");
ClientStorageProviderModel model = realm.getClientStorageProvidersStream().findFirst().get();
Calendar eviction = Calendar.getInstance();
eviction.add(Calendar.HOUR, 1);
model.setCachePolicy(CacheableStorageProviderModel.CachePolicy.EVICT_DAILY);
model.setEvictionHour(eviction.get(HOUR_OF_DAY));
model.setEvictionMinute(eviction.get(MINUTE));
realm.updateComponent(model);
});
testIsCached();
// 2 hours in future
setTimeOffset(2 * 60 * 60);
testNotCached();
testIsCached();
setDefaultCachePolicy();
testIsCached();
}
use of org.keycloak.storage.client.ClientStorageProviderModel in project keycloak by keycloak.
the class HardcodedClientStorage method getParameters.
@Override
public <T> Stream<T> getParameters(Class<T> clazz) {
if (ClientStorageProviderModel.class.isAssignableFrom(clazz)) {
ClientStorageProviderModel clientStorage = new ClientStorageProviderModel();
clientStorage.setName(HardcodedClientStorageProviderFactory.PROVIDER_ID + ":" + counter.getAndIncrement());
clientStorage.setProviderId(HardcodedClientStorageProviderFactory.PROVIDER_ID);
return Stream.of((T) clientStorage);
} else {
return super.getParameters(clazz);
}
}
Aggregations