diff --git a/integration/admin-client/src/main/java/org/keycloak/admin/client/Keycloak.java b/integration/admin-client/src/main/java/org/keycloak/admin/client/Keycloak.java index 20914e5de0..6d6c7beff7 100755 --- a/integration/admin-client/src/main/java/org/keycloak/admin/client/Keycloak.java +++ b/integration/admin-client/src/main/java/org/keycloak/admin/client/Keycloak.java @@ -26,7 +26,7 @@ public class Keycloak { target = client.target(config.getServerUrl()); - target.register(new BearerAuthFilter(tokenManager.getAccessTokenString())); + target.register(new BearerAuthFilter(tokenManager)); } public static Keycloak getInstance(String serverUrl, String realm, String username, String password, String clientId, String clientSecret){ diff --git a/integration/admin-client/src/main/java/org/keycloak/admin/client/resource/BearerAuthFilter.java b/integration/admin-client/src/main/java/org/keycloak/admin/client/resource/BearerAuthFilter.java index 144251357d..a66c14ca86 100644 --- a/integration/admin-client/src/main/java/org/keycloak/admin/client/resource/BearerAuthFilter.java +++ b/integration/admin-client/src/main/java/org/keycloak/admin/client/resource/BearerAuthFilter.java @@ -1,5 +1,7 @@ package org.keycloak.admin.client.resource; +import org.keycloak.admin.client.token.TokenManager; + import javax.ws.rs.client.ClientRequestContext; import javax.ws.rs.client.ClientRequestFilter; import javax.ws.rs.core.HttpHeaders; @@ -11,14 +13,23 @@ import java.io.IOException; public class BearerAuthFilter implements ClientRequestFilter { private final String tokenString; + private final TokenManager tokenManager; public BearerAuthFilter(String tokenString) { this.tokenString = tokenString; + this.tokenManager = null; } + public BearerAuthFilter(TokenManager tokenManager) { + this.tokenManager = tokenManager; + this.tokenString = null; + } + + @Override public void filter(ClientRequestContext requestContext) throws IOException { - String authHeader = "Bearer " + tokenString; + String authHeader = "Bearer " + (tokenManager != null ? tokenManager.getAccessTokenString() : tokenString); + requestContext.getHeaders().add(HttpHeaders.AUTHORIZATION, authHeader); } diff --git a/integration/admin-client/src/main/java/org/keycloak/admin/client/resource/RoleMappingResource.java b/integration/admin-client/src/main/java/org/keycloak/admin/client/resource/RoleMappingResource.java index 65ffe049ab..bd8a91aa99 100755 --- a/integration/admin-client/src/main/java/org/keycloak/admin/client/resource/RoleMappingResource.java +++ b/integration/admin-client/src/main/java/org/keycloak/admin/client/resource/RoleMappingResource.java @@ -22,7 +22,7 @@ public interface RoleMappingResource { @Path("realm") public RoleScopeResource realmLevel(); - @Path("applications/{appName}") - public RoleScopeResource applicationLevel(@PathParam("appName") String appName); + @Path("clients/{clientId}") + public RoleScopeResource clientLevel(@PathParam("clientId") String clientId); } diff --git a/integration/admin-client/src/main/java/org/keycloak/admin/client/token/TokenManager.java b/integration/admin-client/src/main/java/org/keycloak/admin/client/token/TokenManager.java index e38da50a1c..4e694ebc6e 100644 --- a/integration/admin-client/src/main/java/org/keycloak/admin/client/token/TokenManager.java +++ b/integration/admin-client/src/main/java/org/keycloak/admin/client/token/TokenManager.java @@ -66,8 +66,7 @@ public class TokenManager { Form form = new Form() .param("grant_type", "refresh_token") - .param("username", config.getUsername()) - .param("password", config.getPassword()); + .param("refresh_token", currentToken.getRefreshToken()); if(config.isPublicClient()){ form.param("client_id", config.getClientId());