From a09142c43a9a1986be38b7f89eb2dc689d6aaa36 Mon Sep 17 00:00:00 2001 From: stianst Date: Wed, 7 Apr 2021 16:39:03 +0200 Subject: [PATCH] KEYCLOAK-17678 Fix getting client scope by name resulting in listing clients --- .../java/org/keycloak/models/utils/KeycloakModelUtils.java | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/server-spi-private/src/main/java/org/keycloak/models/utils/KeycloakModelUtils.java b/server-spi-private/src/main/java/org/keycloak/models/utils/KeycloakModelUtils.java index 2747ba00a0..55ea2149a9 100755 --- a/server-spi-private/src/main/java/org/keycloak/models/utils/KeycloakModelUtils.java +++ b/server-spi-private/src/main/java/org/keycloak/models/utils/KeycloakModelUtils.java @@ -714,10 +714,7 @@ public final class KeycloakModelUtils { .filter(clientScope -> Objects.equals(clientScopeName, clientScope.getName())) .findFirst() // check if we are referencing a client instead of a scope - .orElse(realm.getClientsStream() - .filter(c -> Objects.equals(clientScopeName, c.getClientId())) - .findFirst() - .orElse(null)); + .orElseGet(() -> realm.getClientByClientId(clientScopeName)); } /**