diff --git a/integration/admin-client/src/main/java/org/keycloak/admin/client/resource/UsersResource.java b/integration/admin-client/src/main/java/org/keycloak/admin/client/resource/UsersResource.java index 9497f3a67a..93a0638b8c 100755 --- a/integration/admin-client/src/main/java/org/keycloak/admin/client/resource/UsersResource.java +++ b/integration/admin-client/src/main/java/org/keycloak/admin/client/resource/UsersResource.java @@ -19,13 +19,7 @@ package org.keycloak.admin.client.resource; import org.keycloak.representations.idm.UserRepresentation; -import javax.ws.rs.Consumes; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; +import javax.ws.rs.*; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import java.util.List; @@ -59,4 +53,7 @@ public interface UsersResource { @Path("{id}") UserResource get(@PathParam("id") String id); + @Path("{id}") + @DELETE + Response delete(@PathParam("id") String id); } diff --git a/testsuite/integration/src/test/java/org/keycloak/testsuite/admin/UserTest.java b/testsuite/integration/src/test/java/org/keycloak/testsuite/admin/UserTest.java index eafe169a74..c2f4b7c010 100755 --- a/testsuite/integration/src/test/java/org/keycloak/testsuite/admin/UserTest.java +++ b/testsuite/integration/src/test/java/org/keycloak/testsuite/admin/UserTest.java @@ -239,6 +239,20 @@ public class UserTest extends AbstractClientTest { assertEquals(9, count.intValue()); } + @Test + public void delete() { + Response response = realm.users().delete( createUser() ); + assertEquals(204, response.getStatus()); + response.close(); + } + + @Test + public void deleteNonExistent() { + Response response = realm.users().delete( "does-not-exist" ); + assertEquals(404, response.getStatus()); + response.close(); + } + @Test public void searchPaginated() { createUsers();