KEYCLOAK-2785: Admin client should be able to delete a user.
The delete user service should be exposed in the admin client.
This commit is contained in:
parent
def40448ac
commit
38670df49a
2 changed files with 18 additions and 7 deletions
|
@ -19,13 +19,7 @@ package org.keycloak.admin.client.resource;
|
||||||
|
|
||||||
import org.keycloak.representations.idm.UserRepresentation;
|
import org.keycloak.representations.idm.UserRepresentation;
|
||||||
|
|
||||||
import javax.ws.rs.Consumes;
|
import javax.ws.rs.*;
|
||||||
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.core.MediaType;
|
import javax.ws.rs.core.MediaType;
|
||||||
import javax.ws.rs.core.Response;
|
import javax.ws.rs.core.Response;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -59,4 +53,7 @@ public interface UsersResource {
|
||||||
@Path("{id}")
|
@Path("{id}")
|
||||||
UserResource get(@PathParam("id") String id);
|
UserResource get(@PathParam("id") String id);
|
||||||
|
|
||||||
|
@Path("{id}")
|
||||||
|
@DELETE
|
||||||
|
Response delete(@PathParam("id") String id);
|
||||||
}
|
}
|
||||||
|
|
|
@ -239,6 +239,20 @@ public class UserTest extends AbstractClientTest {
|
||||||
assertEquals(9, count.intValue());
|
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
|
@Test
|
||||||
public void searchPaginated() {
|
public void searchPaginated() {
|
||||||
createUsers();
|
createUsers();
|
||||||
|
|
Loading…
Reference in a new issue