From 2bba6af6d91975e6c26bce76ec43083fe69fa8db Mon Sep 17 00:00:00 2001 From: Cherian Mathew Date: Tue, 18 Oct 2016 22:51:38 +0200 Subject: [PATCH] Include programmatically created resources in the resource cache --- .../authorization/infinispan/CachedResourceStore.java | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/model/infinispan/src/main/java/org/keycloak/models/authorization/infinispan/CachedResourceStore.java b/model/infinispan/src/main/java/org/keycloak/models/authorization/infinispan/CachedResourceStore.java index f86de2f067..8696d8d11e 100644 --- a/model/infinispan/src/main/java/org/keycloak/models/authorization/infinispan/CachedResourceStore.java +++ b/model/infinispan/src/main/java/org/keycloak/models/authorization/infinispan/CachedResourceStore.java @@ -108,13 +108,9 @@ public class CachedResourceStore implements ResourceStore { @Override public List findByOwner(String ownerId) { - List cachedIds = this.cache.get(getResourceOwnerCacheKey(ownerId)); - if (cachedIds == null) { - for (Resource resource : getDelegate().findByOwner(ownerId)) { - updateCachedIds(getResourceOwnerCacheKey(ownerId), resource, true); - } - cachedIds = this.cache.getOrDefault(getResourceOwnerCacheKey(ownerId), Collections.emptyList()); + for (Resource resource : getDelegate().findByOwner(ownerId)) { + updateCachedIds(getResourceOwnerCacheKey(ownerId), resource, true); } return ((List) this.cache.getOrDefault(getResourceOwnerCacheKey(ownerId), Collections.emptyList())).stream().map(this::findById)