From c998198aacd8a2c9549afc95c0492bc51857e81d Mon Sep 17 00:00:00 2001 From: mposolda Date: Wed, 21 Dec 2016 11:27:15 +0100 Subject: [PATCH] KEYCLOAK-4128 ResourcePermissionManagementTest fails on Oracle DB --- .../org/keycloak/authorization/jpa/store/JPAPolicyStore.java | 2 +- .../testsuite/authorization/AbstractAuthorizationTest.java | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) 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) {