diff --git a/server-spi-private/src/main/java/org/keycloak/authorization/policy/evaluation/Result.java b/server-spi-private/src/main/java/org/keycloak/authorization/policy/evaluation/Result.java index 3c886b6c74..877cc2201a 100644 --- a/server-spi-private/src/main/java/org/keycloak/authorization/policy/evaluation/Result.java +++ b/server-spi-private/src/main/java/org/keycloak/authorization/policy/evaluation/Result.java @@ -86,7 +86,16 @@ public class Result { } public PolicyResult policy(Policy policy, Effect effect) { - return associatedPolicies.computeIfAbsent(policy.getId(), id -> new PolicyResult(policy, effect)); + PolicyResult policyResult = associatedPolicies.get(policy.getId()); + + if (policyResult == null) { + policyResult = new PolicyResult(policy, effect); + associatedPolicies.put(policy.getId(), policyResult); + } else { + policyResult.setEffect(effect); + } + + return policyResult; } public Policy getPolicy() { diff --git a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/adapter/example/authorization/AbstractPhotozExampleAdapterTest.java b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/adapter/example/authorization/AbstractPhotozExampleAdapterTest.java index 0f30155ee6..5cf9070647 100644 --- a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/adapter/example/authorization/AbstractPhotozExampleAdapterTest.java +++ b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/adapter/example/authorization/AbstractPhotozExampleAdapterTest.java @@ -369,7 +369,6 @@ public abstract class AbstractPhotozExampleAdapterTest extends AbstractExampleAd assertThat(getResourcesOfUser("alice"), is(empty())); } - @Ignore @Test public void testClientRoleRepresentingUserConsent() throws Exception { ContainerAssume.assumeNotAuthServerUndertow(); @@ -402,7 +401,6 @@ public abstract class AbstractPhotozExampleAdapterTest extends AbstractExampleAd } @Test - @Ignore public void testClientRoleNotRequired() throws Exception { loginToClientPage("alice", "alice");