Search in sources :

Example 1 with CacheableStorageProviderModel

use of org.keycloak.storage.CacheableStorageProviderModel in project keycloak by keycloak.

the class UserCacheSession method validateCache.

protected UserModel validateCache(RealmModel realm, CachedUser cached) {
    if (!realm.getId().equals(cached.getRealm())) {
        return null;
    }
    StorageId storageId = cached.getFederationLink() != null ? new StorageId(cached.getFederationLink(), cached.getId()) : new StorageId(cached.getId());
    if (!storageId.isLocal()) {
        ComponentModel component = realm.getComponent(storageId.getProviderId());
        CacheableStorageProviderModel model = new CacheableStorageProviderModel(component);
        // its also hard to test stuff
        if (model.shouldInvalidate(cached)) {
            registerUserInvalidation(realm, cached);
            return getDelegate().getUserById(realm, cached.getId());
        }
    }
    return new UserAdapter(cached, this, session, realm);
}
Also used : CacheableStorageProviderModel(org.keycloak.storage.CacheableStorageProviderModel) ComponentModel(org.keycloak.component.ComponentModel) StorageId(org.keycloak.storage.StorageId)

Aggregations

ComponentModel (org.keycloak.component.ComponentModel)1 CacheableStorageProviderModel (org.keycloak.storage.CacheableStorageProviderModel)1 StorageId (org.keycloak.storage.StorageId)1