Java Code Examples for org.keycloak.representations.idm.RealmRepresentation#setDisplayName()
The following examples show how to use
org.keycloak.representations.idm.RealmRepresentation#setDisplayName() .
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: RealmSetup.java From keycloak-custom-protocol-mapper-example with Apache License 2.0 | 5 votes |
public void execute() { RealmRepresentation realmRepresentation = new RealmRepresentation(); realmRepresentation.setDisplayName(REALM); realmRepresentation.setId(REALM); realmRepresentation.setClients(createClients()); realmRepresentation.setLoginWithEmailAllowed(true); realmRepresentation.setEnabled(true); realmRepresentation.setRealm(REALM); this.keycloak.realms().create(realmRepresentation); }
Example 2
Source File: InvalidationCrossDCTest.java From keycloak with Apache License 2.0 | 5 votes |
@Test public void realmInvalidationTest() throws Exception { enableDcOnLoadBalancer(DC.FIRST); enableDcOnLoadBalancer(DC.SECOND); RealmRepresentation realmDc0 = getAdminClientForStartedNodeInDc(0).realms().realm(REALM_NAME).toRepresentation(); RealmRepresentation realmDc1 = getAdminClientForStartedNodeInDc(1).realms().realm(REALM_NAME).toRepresentation(); // Test same realm on both DCs Assert.assertNull(realmDc0.getDisplayName()); Assert.assertTrue(realmDc0.isRegistrationAllowed()); Assert.assertNull(realmDc1.getDisplayName()); Assert.assertTrue(realmDc1.isRegistrationAllowed()); // Update realm on DC0 realmDc0.setRegistrationAllowed(false); realmDc0.setDisplayName("Cool Realm!"); getAdminClientForStartedNodeInDc(0).realms().realm(REALM_NAME).update(realmDc0); // Assert updated on both DC0 and DC1 (here retry is needed. We need to wait until invalidation message arrives) realmDc0 = getAdminClientForStartedNodeInDc(0).realms().realm(REALM_NAME).toRepresentation(); Assert.assertEquals("Cool Realm!", realmDc0.getDisplayName()); Assert.assertFalse(realmDc0.isRegistrationAllowed()); AtomicInteger i = new AtomicInteger(0); Retry.execute(() -> { i.incrementAndGet(); RealmRepresentation realmDcc1 = getAdminClientForStartedNodeInDc(1).realms().realm(REALM_NAME).toRepresentation(); Assert.assertEquals("Cool Realm!", realmDcc1.getDisplayName()); Assert.assertFalse(realmDcc1.isRegistrationAllowed()); }, 50, 50); log.infof("realmInvalidationTest: Passed after '%d' iterations", i.get()); }
Example 3
Source File: RealmTest.java From keycloak with Apache License 2.0 | 4 votes |
@Test public void updateRealmAttributes() { // first change RealmRepresentation rep = new RealmRepresentation(); List<String> webAuthnPolicyAcceptableAaguids = new ArrayList<>(); webAuthnPolicyAcceptableAaguids.add("aaguid1"); webAuthnPolicyAcceptableAaguids.add("aaguid2"); rep.setAttributes(new HashMap<>()); rep.getAttributes().put("foo1", "bar1"); rep.getAttributes().put("foo2", "bar2"); rep.setWebAuthnPolicyAcceptableAaguids(webAuthnPolicyAcceptableAaguids); rep.setBruteForceProtected(true); rep.setDisplayName("dn1"); realm.update(rep); assertAdminEvents.assertEvent(realmId, OperationType.UPDATE, Matchers.nullValue(String.class), rep, ResourceType.REALM); rep = realm.toRepresentation(); assertEquals("bar1", rep.getAttributes().get("foo1")); assertEquals("bar2", rep.getAttributes().get("foo2")); assertTrue(rep.isBruteForceProtected()); assertEquals("dn1", rep.getDisplayName()); assertEquals(webAuthnPolicyAcceptableAaguids, rep.getWebAuthnPolicyAcceptableAaguids()); // second change webAuthnPolicyAcceptableAaguids.clear(); rep.setBruteForceProtected(false); rep.setDisplayName("dn2"); rep.getAttributes().put("foo1", "bar11"); rep.getAttributes().remove("foo2"); rep.setWebAuthnPolicyAcceptableAaguids(webAuthnPolicyAcceptableAaguids); realm.update(rep); assertAdminEvents.assertEvent(realmId, OperationType.UPDATE, Matchers.nullValue(String.class), rep, ResourceType.REALM); rep = realm.toRepresentation(); assertFalse(rep.isBruteForceProtected()); assertEquals("dn2", rep.getDisplayName()); assertEquals("bar11", rep.getAttributes().get("foo1")); assertFalse(rep.getAttributes().containsKey("foo2")); assertTrue(rep.getWebAuthnPolicyAcceptableAaguids().isEmpty()); }
Example 4
Source File: AdminEventTest.java From keycloak with Apache License 2.0 | 4 votes |
private void updateRealm() { RealmRepresentation realm = testRealmResource().toRepresentation(); realm.setDisplayName("Fury Road"); testRealmResource().update(realm); }