diff --git a/common/src/main/java/org/keycloak/common/Profile.java b/common/src/main/java/org/keycloak/common/Profile.java index a46dc2fefc..df270b2360 100755 --- a/common/src/main/java/org/keycloak/common/Profile.java +++ b/common/src/main/java/org/keycloak/common/Profile.java @@ -213,6 +213,10 @@ public class Profile { return !getInstance().disabledFeatures.contains(feature); } + public static boolean isProduct() { + return getInstance().profile.equals(ProfileValue.PRODUCT); + } + private class Config { private Properties properties; diff --git a/services/src/main/java/org/keycloak/theme/DefaultThemeManager.java b/services/src/main/java/org/keycloak/theme/DefaultThemeManager.java index cd239eac6a..4a54c9f6bf 100755 --- a/services/src/main/java/org/keycloak/theme/DefaultThemeManager.java +++ b/services/src/main/java/org/keycloak/theme/DefaultThemeManager.java @@ -49,7 +49,7 @@ public class DefaultThemeManager implements ThemeManager { private final DefaultThemeManagerFactory factory; private final KeycloakSession session; private List providers; - private String defaultTheme; + private final String defaultTheme; public DefaultThemeManager(DefaultThemeManagerFactory factory, KeycloakSession session) { this.factory = factory; @@ -64,11 +64,13 @@ public class DefaultThemeManager implements ThemeManager { } private String typeBasedDefault(Theme.Type type) { + boolean isProduct = Profile.isProduct(); + if ((type == Theme.Type.ACCOUNT) && isAccount2Enabled()) { - return "keycloak.v2"; + return isProduct ? "rh-sso.v2" : "keycloak.v2"; } - - return "keycloak"; + + return isProduct ? "rh-sso" : "keycloak"; } @Override @@ -94,9 +96,9 @@ public class DefaultThemeManager implements ThemeManager { if (!isAccount2Enabled() && theme.getName().equals("keycloak.v2")) { theme = loadTheme("keycloak", type); } - - if (!isAccount2Enabled() && theme.getName().equals("rhsso.v2")) { - theme = loadTheme("rhsso", type); + + if (!isAccount2Enabled() && theme.getName().equals("rh-sso.v2")) { + theme = loadTheme("rh-sso", type); } return theme;