Java Code Examples for org.keycloak.representations.idm.RoleRepresentation#setDescription()

The following examples show how to use org.keycloak.representations.idm.RoleRepresentation#setDescription() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RealmRolesTest.java    From keycloak with Apache License 2.0 6 votes vote down vote up
@Test
public void updateRole() {
    RoleRepresentation role = resource.get("role-a").toRepresentation();

    role.setName("role-a-new");
    role.setDescription("Role A New");

    resource.get("role-a").update(role);
    assertAdminEvents.assertEvent(realmId, OperationType.UPDATE, AdminEventPaths.roleResourcePath("role-a"), role, ResourceType.REALM_ROLE);

    role = resource.get("role-a-new").toRepresentation();

    assertNotNull(role);
    assertEquals("role-a-new", role.getName());
    assertEquals("Role A New", role.getDescription());
    assertFalse(role.isComposite());
}
 
Example 2
Source File: RoleByIdResourceTest.java    From keycloak with Apache License 2.0 6 votes vote down vote up
@Test
public void updateRole() {
    RoleRepresentation role = resource.getRole(ids.get("role-a"));

    role.setName("role-a-new");
    role.setDescription("Role A New");

    resource.updateRole(ids.get("role-a"), role);
    assertAdminEvents.assertEvent(realmId, OperationType.UPDATE, AdminEventPaths.roleByIdResourcePath(ids.get("role-a")), role, ResourceType.REALM_ROLE);

    role = resource.getRole(ids.get("role-a"));

    assertNotNull(role);
    assertEquals("role-a-new", role.getName());
    assertEquals("Role A New", role.getDescription());
    assertFalse(role.isComposite());
}
 
Example 3
Source File: RoleInvalidationClusterTest.java    From keycloak with Apache License 2.0 5 votes vote down vote up
@Override
protected RoleRepresentation createTestEntityRepresentation() {
    RoleRepresentation role = new RoleRepresentation();
    role.setName("role_" + RandomStringUtils.randomAlphabetic(5));
    role.setComposite(false);
    role.setDescription("description of "+role.getName());
    return role;
}
 
Example 4
Source File: RoleInvalidationClusterTest.java    From keycloak with Apache License 2.0 5 votes vote down vote up
@Override
protected RoleRepresentation testEntityUpdates(RoleRepresentation role, boolean backendFailover) {

    // description
    role.setDescription(role.getDescription()+"_- updated");
    role = updateEntityOnCurrentFailNode(role, "description");
    verifyEntityUpdateDuringFailover(role, backendFailover);
    
    // TODO composites

    return role;
}
 
Example 5
Source File: RoleDetailsForm.java    From keycloak with Apache License 2.0 5 votes vote down vote up
public RoleRepresentation getBasicAttributes() {
    RoleRepresentation role = new RoleRepresentation();
    role.setName(getName());
    role.setDescription(getDescription());
    role.setComposite(isComposite());
    log.info(role.getName() + ": " + role.getDescription() + ", comp: " + role.isComposite());
    return role;
}