Merge remote-tracking branch 'upstream/master'

This commit is contained in:
Bill Burke committed 2016-01-04 11:26:15 -05:00
commit 6d5de7b44e
22 files changed
+477 -219

No files matched your search

@@ -17,9 +17,8 @@ import org.keycloak.models.KeycloakSession;
import org.keycloak.models.KeycloakSessionFactory;
import org.keycloak.models.cache.CacheRealmProvider;
import org.keycloak.models.cache.CacheRealmProviderFactory;
import org.keycloak.models.cache.RealmCache;
import org.keycloak.models.cache.entities.CachedClient;
import org.keycloak.models.cache.entities.CachedRealm;
import org.keycloak.models.cache.entities.CachedUser;
import java.util.concurrent.ConcurrentHashMap;
@@ -143,11 +142,23 @@ public class InfinispanCacheRealmProviderFactory implements CacheRealmProviderFa
realmLookup.remove(realm.getName());
for (String r : realm.getRealmRoles().values()) {
realmCache.evictCachedRoleById(r);
}
for (String c : realm.getClients().values()) {
realmCache.evictCachedApplicationById(c);
}
log.tracev("Realm removed realm={0}", realm.getName());
} else if (object instanceof CachedClient) {
CachedClient client = (CachedClient) object;
for (String r : client.getRoles().values()) {
realmCache.evictCachedRoleById(r);
}
log.tracev("Client removed client={0}", client.getId());
}
}
}
@@ -160,6 +160,12 @@ public class InfinispanRealmCache implements RealmCache {
cache.remove(id);
}
@Override
public void evictCachedRoleById(String id) {
logger.tracev("Evicting role {0}", id);
cache.evict(id);
}
@Override
public void addCachedRole(CachedRole role) {
if (!enabled) return;
@@ -37,6 +37,8 @@ public interface RealmCache {
void invalidateRole(CachedRole role);
void evictCachedRoleById(String id);
void addCachedRole(CachedRole role);
void invalidateCachedRoleById(String id);