KEYCLOAK-725 Add realm update to the Admin Client

This commit is contained in:
Stian Thorgersen 2014-09-30 15:42:48 +02:00
parent 0f307afd16
commit f026772c87
2 changed files with 20 additions and 0 deletions

View file

@ -2,8 +2,10 @@ package org.keycloak.admin.client.resource;
import org.keycloak.representations.idm.RealmRepresentation; import org.keycloak.representations.idm.RealmRepresentation;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE; import javax.ws.rs.DELETE;
import javax.ws.rs.GET; import javax.ws.rs.GET;
import javax.ws.rs.PUT;
import javax.ws.rs.Path; import javax.ws.rs.Path;
import javax.ws.rs.Produces; import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MediaType;
@ -17,6 +19,10 @@ public interface RealmResource {
@Produces(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
public RealmRepresentation toRepresentation(); public RealmRepresentation toRepresentation();
@PUT
@Consumes(MediaType.APPLICATION_JSON)
public void update(RealmRepresentation realmRepresentation);
@Path("applications") @Path("applications")
public ApplicationsResource applications(); public ApplicationsResource applications();

View file

@ -46,6 +46,20 @@ public class RealmTest extends AbstractClientTest {
assertNames(keycloak.realms().findAll(), "master", "test"); assertNames(keycloak.realms().findAll(), "master", "test");
} }
@Test
public void updateRealm() {
RealmRepresentation rep = realm.toRepresentation();
rep.setSsoSessionIdleTimeout(123);
rep.setSsoSessionMaxLifespan(12);
realm.update(rep);
rep = realm.toRepresentation();
assertEquals(123, rep.getSsoSessionIdleTimeout().intValue());
assertEquals(12, rep.getSsoSessionMaxLifespan().intValue());
}
@Test @Test
public void getRealmRepresentation() { public void getRealmRepresentation() {
RealmRepresentation rep = realm.toRepresentation(); RealmRepresentation rep = realm.toRepresentation();