Java Code Examples for org.keycloak.representations.idm.RoleRepresentation#getComposites()
The following examples show how to use
org.keycloak.representations.idm.RoleRepresentation#getComposites() .
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: ImportRolesIT.java From keycloak-config-cli with Apache License 2.0 | 6 votes |
@Test @Order(11) void shouldAddRealmRoleWithRealmComposite() { doImport("11_update_realm__add_realm_role_with_realm_composite.json"); RealmRepresentation createdRealm = keycloakProvider.get().realm(REALM_NAME).toRepresentation(); assertThat(createdRealm.getRealm(), is(REALM_NAME)); assertThat(createdRealm.isEnabled(), is(true)); RoleRepresentation realmRole = keycloakRepository.getRealmRole( REALM_NAME, "my_composite_realm_role" ); assertThat(realmRole.getName(), is("my_composite_realm_role")); assertThat(realmRole.isComposite(), is(true)); assertThat(realmRole.getClientRole(), is(false)); assertThat(realmRole.getDescription(), is("My added composite realm role")); RoleRepresentation.Composites composites = realmRole.getComposites(); assertThat(composites, notNullValue()); assertThat(composites.getRealm(), contains("my_realm_role")); assertThat(composites.getClient(), is(nullValue())); }
Example 2
Source File: ImportRolesIT.java From keycloak-config-cli with Apache License 2.0 | 6 votes |
@Test @Order(13) void shouldAddRealmCompositeToRealmRole() { doImport("13_update_realm__add_realm_composite_to_realm_role.json"); RealmRepresentation createdRealm = keycloakProvider.get().realm(REALM_NAME).toRepresentation(); assertThat(createdRealm.getRealm(), is(REALM_NAME)); assertThat(createdRealm.isEnabled(), is(true)); RoleRepresentation realmRole = keycloakRepository.getRealmRole( REALM_NAME, "my_composite_realm_role" ); assertThat(realmRole.getName(), is("my_composite_realm_role")); assertThat(realmRole.isComposite(), is(true)); assertThat(realmRole.getClientRole(), is(false)); assertThat(realmRole.getDescription(), is("My added composite realm role")); RoleRepresentation.Composites composites = realmRole.getComposites(); assertThat(composites, notNullValue()); assertThat(composites.getRealm(), containsInAnyOrder("my_realm_role", "my_other_realm_role")); assertThat(composites.getClient(), is(nullValue())); }
Example 3
Source File: ImportRolesIT.java From keycloak-config-cli with Apache License 2.0 | 6 votes |
@Test @Order(16) void shouldAddClientRoleWithRealmRoleComposite() { doImport("16_update_realm__add_client_role_with_realm_role_composite.json"); RealmRepresentation createdRealm = keycloakProvider.get().realm(REALM_NAME).toRepresentation(); assertThat(createdRealm.getRealm(), is(REALM_NAME)); assertThat(createdRealm.isEnabled(), is(true)); RoleRepresentation realmRole = keycloakRepository.getClientRole( REALM_NAME, "moped-client", "my_composite_moped_client_role" ); assertThat(realmRole.getName(), is("my_composite_moped_client_role")); assertThat(realmRole.isComposite(), is(true)); assertThat(realmRole.getClientRole(), is(true)); assertThat(realmRole.getDescription(), is("My composite moped-client role")); RoleRepresentation.Composites composites = realmRole.getComposites(); assertThat(composites, notNullValue()); assertThat(composites.getRealm(), contains("my_realm_role")); assertThat(composites.getClient(), is(nullValue())); }
Example 4
Source File: ImportRolesIT.java From keycloak-config-cli with Apache License 2.0 | 6 votes |
@Test @Order(24) void shouldRemoveRealmCompositeFromClientRole() { doImport("24_update_realm__remove_realm_role_composite_from_client_role.json"); RealmRepresentation createdRealm = keycloakProvider.get().realm(REALM_NAME).toRepresentation(); assertThat(createdRealm.getRealm(), is(REALM_NAME)); assertThat(createdRealm.isEnabled(), is(true)); RoleRepresentation realmRole = keycloakRepository.getClientRole( REALM_NAME, "moped-client", "my_composite_moped_client_role" ); assertThat(realmRole.getName(), is("my_composite_moped_client_role")); assertThat(realmRole.isComposite(), is(true)); assertThat(realmRole.getClientRole(), is(true)); assertThat(realmRole.getDescription(), is("My composite moped-client role")); RoleRepresentation.Composites composites = realmRole.getComposites(); assertThat(composites, notNullValue()); assertThat(composites.getRealm(), contains("my_other_realm_role")); assertThat(composites.getClient(), is(nullValue())); }
Example 5
Source File: ImportRolesIT.java From keycloak-config-cli with Apache License 2.0 | 6 votes |
@Test @Order(18) void shouldAddRealmRoleCompositeToClientRole() { doImport("18_update_realm__add_realm_role_composite to_client_role.json"); RealmRepresentation createdRealm = keycloakProvider.get().realm(REALM_NAME).toRepresentation(); assertThat(createdRealm.getRealm(), is(REALM_NAME)); assertThat(createdRealm.isEnabled(), is(true)); RoleRepresentation realmRole = keycloakRepository.getClientRole( REALM_NAME, "moped-client", "my_composite_moped_client_role" ); assertThat(realmRole.getName(), is("my_composite_moped_client_role")); assertThat(realmRole.isComposite(), is(true)); assertThat(realmRole.getClientRole(), is(true)); assertThat(realmRole.getDescription(), is("My composite moped-client role")); RoleRepresentation.Composites composites = realmRole.getComposites(); assertThat(composites, notNullValue()); assertThat(composites.getRealm(), containsInAnyOrder("my_realm_role", "my_other_realm_role")); assertThat(composites.getClient(), is(nullValue())); }
Example 6
Source File: ImportRolesIT.java From keycloak-config-cli with Apache License 2.0 | 6 votes |
@Test @Order(21) void shouldRemoveRealmCompositeFromRealmRole() { doImport("21_update_realm__remove_realm_role_composite_from_realm_role.json"); RealmRepresentation createdRealm = keycloakProvider.get().realm(REALM_NAME).toRepresentation(); assertThat(createdRealm.getRealm(), is(REALM_NAME)); assertThat(createdRealm.isEnabled(), is(true)); RoleRepresentation realmRole = keycloakRepository.getRealmRole( REALM_NAME, "my_composite_realm_role" ); assertThat(realmRole.getName(), is("my_composite_realm_role")); assertThat(realmRole.isComposite(), is(true)); assertThat(realmRole.getClientRole(), is(false)); assertThat(realmRole.getDescription(), is("My added composite realm role")); RoleRepresentation.Composites composites = realmRole.getComposites(); assertThat(composites, notNullValue()); assertThat(composites.getRealm(), contains("my_other_realm_role")); assertThat(composites.getClient(), is(nullValue())); }
Example 7
Source File: ImportRolesIT.java From keycloak-config-cli with Apache License 2.0 | 5 votes |
@Test @Order(12) void shouldAddRealmRoleWithClientComposite() { doImport("12_update_realm__add_realm_role_with_client_composite.json"); RealmRepresentation createdRealm = keycloakProvider.get().realm(REALM_NAME).toRepresentation(); assertThat(createdRealm.getRealm(), is(REALM_NAME)); assertThat(createdRealm.isEnabled(), is(true)); RoleRepresentation realmRole = keycloakRepository.getRealmRole( REALM_NAME, "my_composite_client_role" ); assertThat(realmRole.getName(), is("my_composite_client_role")); assertThat(realmRole.isComposite(), is(true)); assertThat(realmRole.getClientRole(), is(false)); assertThat(realmRole.getDescription(), is("My added composite client role")); RoleRepresentation.Composites composites = realmRole.getComposites(); assertThat(composites, notNullValue()); assertThat(composites.getRealm(), is(nullValue())); assertThat(composites.getClient(), aMapWithSize(1)); assertThat(composites.getClient(), hasEntry(is("moped-client"), containsInAnyOrder("my_client_role"))); }
Example 8
Source File: ImportRolesIT.java From keycloak-config-cli with Apache License 2.0 | 5 votes |
@Test @Order(26) void shouldRemoveClientCompositesFromClientRole() { doImport("26_update_realm__remove_client_role_composites_from_client_role.json"); RealmRepresentation createdRealm = keycloakProvider.get().realm(REALM_NAME).toRepresentation(); assertThat(createdRealm.getRealm(), is(REALM_NAME)); assertThat(createdRealm.isEnabled(), is(true)); RoleRepresentation realmRole = keycloakRepository.getClientRole( REALM_NAME, "moped-client", "my_other_composite_moped_client_role" ); assertThat(realmRole.getName(), is("my_other_composite_moped_client_role")); assertThat(realmRole.isComposite(), is(true)); assertThat(realmRole.getClientRole(), is(true)); assertThat(realmRole.getDescription(), is("My other composite moped-client role")); RoleRepresentation.Composites composites = realmRole.getComposites(); assertThat(composites, notNullValue()); assertThat(composites.getRealm(), is(nullValue())); assertThat(composites.getClient(), aMapWithSize(1)); assertThat(composites.getClient(), hasEntry(is("second-moped-client"), containsInAnyOrder("my_other_second_client_role"))); }
Example 9
Source File: ImportRolesIT.java From keycloak-config-cli with Apache License 2.0 | 5 votes |
@Test @Order(25) void shouldRemoveClientCompositeFromClientRole() { doImport("25_update_realm__remove_client_role_composite_from_client_role.json"); RealmRepresentation createdRealm = keycloakProvider.get().realm(REALM_NAME).toRepresentation(); assertThat(createdRealm.getRealm(), is(REALM_NAME)); assertThat(createdRealm.isEnabled(), is(true)); RoleRepresentation realmRole = keycloakRepository.getClientRole( REALM_NAME, "moped-client", "my_other_composite_moped_client_role" ); assertThat(realmRole.getName(), is("my_other_composite_moped_client_role")); assertThat(realmRole.isComposite(), is(true)); assertThat(realmRole.getClientRole(), is(true)); assertThat(realmRole.getDescription(), is("My other composite moped-client role")); RoleRepresentation.Composites composites = realmRole.getComposites(); assertThat(composites, notNullValue()); assertThat(composites.getRealm(), is(nullValue())); assertThat(composites.getClient(), aMapWithSize(2)); assertThat(composites.getClient(), hasEntry(is("moped-client"), containsInAnyOrder("my_client_role", "my_other_client_role"))); assertThat(composites.getClient(), hasEntry(is("second-moped-client"), containsInAnyOrder("my_other_second_client_role"))); }
Example 10
Source File: ImportRolesIT.java From keycloak-config-cli with Apache License 2.0 | 5 votes |
@Test @Order(23) void shouldRemoveClientCompositesFromRealmRole() { doImport("23_update_realm__remove_client_role_composites_from_realm_role.json"); RealmRepresentation createdRealm = keycloakProvider.get().realm(REALM_NAME).toRepresentation(); assertThat(createdRealm.getRealm(), is(REALM_NAME)); assertThat(createdRealm.isEnabled(), is(true)); RoleRepresentation realmRole = keycloakRepository.getRealmRole( REALM_NAME, "my_composite_client_role" ); assertThat(realmRole.getName(), is("my_composite_client_role")); assertThat(realmRole.isComposite(), is(true)); assertThat(realmRole.getClientRole(), is(false)); assertThat(realmRole.getDescription(), is("My added composite client role")); RoleRepresentation.Composites composites = realmRole.getComposites(); assertThat(composites, notNullValue()); assertThat(composites.getRealm(), is(nullValue())); assertThat(composites.getClient(), aMapWithSize(1)); assertThat(composites.getClient(), hasEntry(is("moped-client"), containsInAnyOrder("my_other_client_role"))); }
Example 11
Source File: ImportRolesIT.java From keycloak-config-cli with Apache License 2.0 | 5 votes |
@Test @Order(22) void shouldRemoveCompositeClientFromRealmRole() { doImport("22_update_realm__remove_client_role_composite_from_realm_role.json"); RealmRepresentation createdRealm = keycloakProvider.get().realm(REALM_NAME).toRepresentation(); assertThat(createdRealm.getRealm(), is(REALM_NAME)); assertThat(createdRealm.isEnabled(), is(true)); RoleRepresentation realmRole = keycloakRepository.getRealmRole( REALM_NAME, "my_composite_client_role" ); assertThat(realmRole.getName(), is("my_composite_client_role")); assertThat(realmRole.isComposite(), is(true)); assertThat(realmRole.getClientRole(), is(false)); assertThat(realmRole.getDescription(), is("My added composite client role")); RoleRepresentation.Composites composites = realmRole.getComposites(); assertThat(composites, notNullValue()); assertThat(composites.getRealm(), is(nullValue())); assertThat(composites.getClient(), aMapWithSize(2)); assertThat(composites.getClient(), hasEntry(is("moped-client"), containsInAnyOrder("my_other_client_role"))); assertThat(composites.getClient(), hasEntry(is("second-moped-client"), containsInAnyOrder("my_other_second_client_role", "my_second_client_role"))); }
Example 12
Source File: ImportRolesIT.java From keycloak-config-cli with Apache License 2.0 | 5 votes |
@Test @Order(20) void shouldAddClientRoleCompositesToClientRole() { doImport("20_update_realm__add_client_role_composites_to_client_role.json"); RealmRepresentation createdRealm = keycloakProvider.get().realm(REALM_NAME).toRepresentation(); assertThat(createdRealm.getRealm(), is(REALM_NAME)); assertThat(createdRealm.isEnabled(), is(true)); RoleRepresentation realmRole = keycloakRepository.getClientRole( REALM_NAME, "moped-client", "my_other_composite_moped_client_role" ); assertThat(realmRole.getName(), is("my_other_composite_moped_client_role")); assertThat(realmRole.isComposite(), is(true)); assertThat(realmRole.getClientRole(), is(true)); assertThat(realmRole.getDescription(), is("My other composite moped-client role")); RoleRepresentation.Composites composites = realmRole.getComposites(); assertThat(composites, notNullValue()); assertThat(composites.getRealm(), is(nullValue())); assertThat(composites.getClient(), aMapWithSize(2)); assertThat(composites.getClient(), hasEntry(is("moped-client"), containsInAnyOrder("my_client_role", "my_other_client_role"))); assertThat(composites.getClient(), hasEntry(is("second-moped-client"), containsInAnyOrder("my_other_second_client_role", "my_second_client_role"))); }
Example 13
Source File: ImportRolesIT.java From keycloak-config-cli with Apache License 2.0 | 5 votes |
@Test @Order(19) void shouldAddClientRoleCompositeToClientRole() { doImport("19_update_realm__add_client_role_composite to_client_role.json"); RealmRepresentation createdRealm = keycloakProvider.get().realm(REALM_NAME).toRepresentation(); assertThat(createdRealm.getRealm(), is(REALM_NAME)); assertThat(createdRealm.isEnabled(), is(true)); RoleRepresentation realmRole = keycloakRepository.getClientRole( REALM_NAME, "moped-client", "my_other_composite_moped_client_role" ); assertThat(realmRole.getName(), is("my_other_composite_moped_client_role")); assertThat(realmRole.isComposite(), is(true)); assertThat(realmRole.getClientRole(), is(true)); assertThat(realmRole.getDescription(), is("My other composite moped-client role")); RoleRepresentation.Composites composites = realmRole.getComposites(); assertThat(composites, notNullValue()); assertThat(composites.getRealm(), is(nullValue())); assertThat(composites.getClient(), aMapWithSize(1)); assertThat(composites.getClient(), hasEntry(is("moped-client"), containsInAnyOrder("my_client_role", "my_other_client_role"))); }
Example 14
Source File: ImportRolesIT.java From keycloak-config-cli with Apache License 2.0 | 5 votes |
@Test @Order(17) void shouldAddClientRoleWithClientRoleComposite() { doImport("17_update_realm__add_client_role_with_client_role_composite.json"); RealmRepresentation createdRealm = keycloakProvider.get().realm(REALM_NAME).toRepresentation(); assertThat(createdRealm.getRealm(), is(REALM_NAME)); assertThat(createdRealm.isEnabled(), is(true)); RoleRepresentation realmRole = keycloakRepository.getClientRole( REALM_NAME, "moped-client", "my_other_composite_moped_client_role" ); assertThat(realmRole.getName(), is("my_other_composite_moped_client_role")); assertThat(realmRole.isComposite(), is(true)); assertThat(realmRole.getClientRole(), is(true)); assertThat(realmRole.getDescription(), is("My other composite moped-client role")); RoleRepresentation.Composites composites = realmRole.getComposites(); assertThat(composites, notNullValue()); assertThat(composites.getRealm(), is(nullValue())); assertThat(composites.getClient(), aMapWithSize(1)); assertThat(composites.getClient(), hasEntry(is("moped-client"), containsInAnyOrder("my_client_role"))); }
Example 15
Source File: ImportRolesIT.java From keycloak-config-cli with Apache License 2.0 | 5 votes |
@Test @Order(15) void shouldAddCompositeClientToRealmRole() { doImport("15_update_realm__add_composite_client_to_realm_role.json"); RealmRepresentation createdRealm = keycloakProvider.get().realm(REALM_NAME).toRepresentation(); assertThat(createdRealm.getRealm(), is(REALM_NAME)); assertThat(createdRealm.isEnabled(), is(true)); RoleRepresentation realmRole = keycloakRepository.getRealmRole( REALM_NAME, "my_composite_client_role" ); assertThat(realmRole.getName(), is("my_composite_client_role")); assertThat(realmRole.isComposite(), is(true)); assertThat(realmRole.getClientRole(), is(false)); assertThat(realmRole.getDescription(), is("My added composite client role")); RoleRepresentation.Composites composites = realmRole.getComposites(); assertThat(composites, notNullValue()); assertThat(composites.getRealm(), is(nullValue())); assertThat(composites.getClient(), aMapWithSize(2)); assertThat(composites.getClient(), hasEntry(is("moped-client"), containsInAnyOrder("my_client_role", "my_other_client_role"))); assertThat(composites.getClient(), hasEntry(is("second-moped-client"), containsInAnyOrder("my_other_second_client_role", "my_second_client_role"))); }
Example 16
Source File: ImportRolesIT.java From keycloak-config-cli with Apache License 2.0 | 5 votes |
@Test @Order(14) void shouldAddClientCompositeToRealmRole() { doImport("14_update_realm__add_client_composite_to_realm_role.json"); RealmRepresentation createdRealm = keycloakProvider.get().realm(REALM_NAME).toRepresentation(); assertThat(createdRealm.getRealm(), is(REALM_NAME)); assertThat(createdRealm.isEnabled(), is(true)); RoleRepresentation realmRole = keycloakRepository.getRealmRole( REALM_NAME, "my_composite_client_role" ); assertThat(realmRole.getName(), is("my_composite_client_role")); assertThat(realmRole.isComposite(), is(true)); assertThat(realmRole.getClientRole(), is(false)); assertThat(realmRole.getDescription(), is("My added composite client role")); RoleRepresentation.Composites composites = realmRole.getComposites(); assertThat(composites, notNullValue()); assertThat(composites.getRealm(), is(nullValue())); assertThat(composites.getClient(), aMapWithSize(1)); assertThat(composites.getClient(), hasEntry(is("moped-client"), containsInAnyOrder("my_client_role", "my_other_client_role"))); }
Example 17
Source File: RoleDetailsForm.java From keycloak with Apache License 2.0 | 4 votes |
public void setCompositeRoles(RoleRepresentation role) { if (role.isComposite() && role.getComposites() != null) { setComposite(true); } compositeRoles.setComposites(role.getComposites()); }