Java Code Examples for org.keycloak.representations.idm.RealmRepresentation#setAccountTheme()

The following examples show how to use org.keycloak.representations.idm.RealmRepresentation#setAccountTheme() . 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: AbstractUiTest.java    From keycloak with Apache License 2.0 6 votes vote down vote up
protected void configureInternationalizationForRealm(RealmRepresentation realm) {
    final String localizedTheme = isAccountPreviewTheme() ? LOCALIZED_THEME_PREVIEW : LOCALIZED_THEME;

    // fetch the supported locales for the special test theme that includes some fake test locales
    Set<String> supportedLocales = adminClient.serverInfo().getInfo().getThemes().get("login").stream()
            .filter(x -> x.getName().equals(LOCALIZED_THEME))
            .flatMap(x -> Arrays.stream(x.getLocales()))
            .collect(Collectors.toSet());

    realm.setInternationalizationEnabled(true);
    realm.setSupportedLocales(supportedLocales);
    realm.setLoginTheme(LOCALIZED_THEME);
    realm.setAdminTheme(LOCALIZED_THEME);
    realm.setAccountTheme(localizedTheme);
    realm.setEmailTheme(LOCALIZED_THEME);
}
 
Example 2
Source File: InternationalizationTest.java    From keycloak with Apache License 2.0 6 votes vote down vote up
@Before
public void beforeInternationalizationTest() {
    RealmRepresentation realmRepresentation = testRealmResource().toRepresentation();
    realmRepresentation.setAccountTheme(THEME_NAME);
    realmRepresentation.setAdminTheme(THEME_NAME);
    realmRepresentation.setEmailTheme(THEME_NAME);
    realmRepresentation.setLoginTheme(THEME_NAME);
    testRealmResource().update(realmRepresentation);

    realmSettingsPage.navigateTo();
    tabs().themes();
    themeSettingsPage.setInternatEnabled(true);
    themeSettingsPage.saveTheme();
    assertAlertSuccess();
    realmSettingsPage.setAdminRealm(AuthRealm.TEST);
    deleteAllCookiesForTestRealm();
    deleteAllCookiesForMasterRealm();
}
 
Example 3
Source File: CustomThemeTest.java    From keycloak with Apache License 2.0 5 votes vote down vote up
@Override
public void configureTestRealm(RealmRepresentation testRealm) {
    testRealm.setAccountTheme("address");

    UserRepresentation user2 = UserBuilder.create()
            .enabled(true)
            .username("test-user-no-access@localhost")
            .email("test-user-no-access@localhost")
            .password("password")
            .build();

    RealmBuilder.edit(testRealm)
            .user(user2);
}
 
Example 4
Source File: ReferrerTest.java    From keycloak with Apache License 2.0 5 votes vote down vote up
@Override
public void addTestRealms(List<RealmRepresentation> testRealms) {
    super.addTestRealms(testRealms);
    RealmRepresentation testRealm = testRealms.get(0);

    ClientRepresentation testClient = new ClientRepresentation();
    testClient.setClientId(FAKE_CLIENT_ID);
    testClient.setName(LOCALE_CLIENT_NAME);
    testClient.setRedirectUris(Collections.singletonList(getFakeClientUrl()));
    testClient.setEnabled(true);

    testRealm.setClients(Collections.singletonList(testClient));
    testRealm.setAccountTheme(LOCALIZED_THEME_PREVIEW); // using localized custom theme for the fake client localized name
}
 
Example 5
Source File: DeviceActivityTest.java    From keycloak with Apache License 2.0 5 votes vote down vote up
@Override
public void addTestRealms(List<RealmRepresentation> testRealms) {
    super.addTestRealms(testRealms);
    RealmRepresentation realm = testRealms.get(0);

    realm.setClients(Arrays.asList(
            ClientBuilder
                    .create()
                    .clientId(TEST_CLIENT_ID) // client with no name
                    .secret(TEST_CLIENT_SECRET)
                    .directAccessGrants()
                    .build(),
            ClientBuilder
                    .create().
                    clientId(TEST_CLIENT2_ID)
                    .name(LOCALE_CLIENT_NAME) // client with localized name
                    .secret(TEST_CLIENT2_SECRET)
                    .directAccessGrants().build(),
            ClientBuilder
                    .create().
                    clientId(TEST_CLIENT3_ID)
                    .name(TEST_CLIENT3_NAME) // client without localized name
                    .secret(TEST_CLIENT3_SECRET)
                    .directAccessGrants().build()

    ));

    realm.setAccountTheme(LOCALIZED_THEME_PREVIEW); // using localized custom theme for the client localized name
}
 
Example 6
Source File: AbstractAccountTest.java    From keycloak with Apache License 2.0 4 votes vote down vote up
@Override
public void addTestRealms(List<RealmRepresentation> testRealms) {
    super.addTestRealms(testRealms);
    RealmRepresentation testRealmRep = testRealms.get(0);
    testRealmRep.setAccountTheme(getAccountThemeName());
}