diff --git a/model/jpa/src/main/java/org/keycloak/authorization/jpa/store/JPAPolicyStore.java b/model/jpa/src/main/java/org/keycloak/authorization/jpa/store/JPAPolicyStore.java index 544018da0a..22fb951940 100644 --- a/model/jpa/src/main/java/org/keycloak/authorization/jpa/store/JPAPolicyStore.java +++ b/model/jpa/src/main/java/org/keycloak/authorization/jpa/store/JPAPolicyStore.java @@ -168,7 +168,7 @@ public class JPAPolicyStore implements PolicyStore { @Override public List findByResourceType(final String resourceType, String resourceServerId) { - Query query = getEntityManager().createQuery("select p from PolicyEntity p inner join p.config c where p.resourceServer.id = :serverId and KEY(c) = 'defaultResourceType' and c = :type"); + Query query = getEntityManager().createQuery("select p from PolicyEntity p inner join p.config c where p.resourceServer.id = :serverId and KEY(c) = 'defaultResourceType' and c like :type"); query.setParameter("serverId", resourceServerId); query.setParameter("type", resourceType); diff --git a/testsuite/integration/src/test/java/org/keycloak/testsuite/authorization/AbstractAuthorizationTest.java b/testsuite/integration/src/test/java/org/keycloak/testsuite/authorization/AbstractAuthorizationTest.java index fbf602ec4b..ebf7144e12 100644 --- a/testsuite/integration/src/test/java/org/keycloak/testsuite/authorization/AbstractAuthorizationTest.java +++ b/testsuite/integration/src/test/java/org/keycloak/testsuite/authorization/AbstractAuthorizationTest.java @@ -99,11 +99,13 @@ public abstract class AbstractAuthorizationTest { } protected Invocation.Builder newClient(ClientModel client, String authzRelativePath) { + String targetUrl = AUTH_SERVER_ROOT + "/admin/realms/" + TEST_REALM_NAME + "/clients/" + client.getId() + "/authz" + authzRelativePath; + return ClientBuilder.newClient() .register((ClientRequestFilter) requestContext -> { AccessTokenResponse accessToken = adminClient.tokenManager().getAccessToken(); requestContext.getHeaders().add("Authorization", "Bearer " + accessToken.getToken()); - }).target(AUTH_SERVER_ROOT + "/admin/realms/" + TEST_REALM_NAME + "/clients/" + client.getId() + "/authz" + authzRelativePath).request(); + }).target(targetUrl).request(); } protected ClientModel getClientByClientId(String clientId) {