diff --git a/js/apps/account-ui/pom.xml b/js/apps/account-ui/pom.xml index 43156606af..c7202adf31 100644 --- a/js/apps/account-ui/pom.xml +++ b/js/apps/account-ui/pom.xml @@ -88,8 +88,8 @@ diff --git a/js/apps/admin-ui/src/environment.ts b/js/apps/admin-ui/src/environment.ts index 8604c959a1..413f315f94 100644 --- a/js/apps/admin-ui/src/environment.ts +++ b/js/apps/admin-ui/src/environment.ts @@ -1,6 +1,8 @@ export type Environment = { - /** The realm which should be used when signing into the application. */ + /** The realm used to authenticate the user to the Admin Console. */ loginRealm: string; + /** The identifier of the client used to authenticate the user to the Admin Console. */ + clientId: string; /** The URL to the root of the auth server. */ authServerUrl: string; /** The URL to the path of the auth server where client requests can be sent. */ @@ -13,8 +15,6 @@ export type Environment = { masterRealm: string; /** The version hash of the auth server. */ resourceVersion: string; - /** Indicates if the application is running as a Keycloak theme. */ - isRunningAsTheme: boolean; /** Indicates the src for the Brand image */ logo: string; /** Indicates the url to be followed when Brand image is clicked */ @@ -27,13 +27,13 @@ const realm = new URLSearchParams(window.location.search).get("realm"); // The default environment, used during development. const defaultEnvironment: Environment = { loginRealm: realm ?? "master", + clientId: "security-admin-console-v2", authServerUrl: "http://localhost:8180", authUrl: "http://localhost:8180", consoleBaseUrl: "/admin/master/console/", resourceUrl: ".", masterRealm: "master", resourceVersion: "unknown", - isRunningAsTheme: false, logo: "/logo.svg", logoUrl: "", }; diff --git a/js/apps/admin-ui/src/keycloak.ts b/js/apps/admin-ui/src/keycloak.ts index e6c627c0e0..bb89ec30cc 100644 --- a/js/apps/admin-ui/src/keycloak.ts +++ b/js/apps/admin-ui/src/keycloak.ts @@ -5,9 +5,7 @@ import environment from "./environment"; export const keycloak = new Keycloak({ url: environment.authServerUrl, realm: environment.loginRealm, - clientId: environment.isRunningAsTheme - ? "security-admin-console" - : "security-admin-console-v2", + clientId: environment.clientId, }); export async function initKeycloak() { diff --git a/services/src/main/java/org/keycloak/services/resources/account/AccountConsole.java b/services/src/main/java/org/keycloak/services/resources/account/AccountConsole.java index b5e0041b5a..2c975a8c59 100644 --- a/services/src/main/java/org/keycloak/services/resources/account/AccountConsole.java +++ b/services/src/main/java/org/keycloak/services/resources/account/AccountConsole.java @@ -95,6 +95,7 @@ public class AccountConsole { map.put("authUrl", authUrl.getPath().endsWith("/") ? authUrl : authUrl + "/"); map.put("baseUrl", accountBaseUrl); map.put("realm", realm); + map.put("clientId", Constants.ACCOUNT_CONSOLE_CLIENT_ID); map.put("resourceUrl", Urls.themeRoot(authUrl).getPath() + "/" + Constants.ACCOUNT_MANAGEMENT_CLIENT_ID + "/" + theme.getName()); map.put("resourceCommonUrl", Urls.themeRoot(adminBaseUri).getPath() + "/common/keycloak"); map.put("resourceVersion", Version.RESOURCES_VERSION); diff --git a/services/src/main/java/org/keycloak/services/resources/admin/AdminConsole.java b/services/src/main/java/org/keycloak/services/resources/admin/AdminConsole.java index 298b7c5fa3..e4d68ae673 100644 --- a/services/src/main/java/org/keycloak/services/resources/admin/AdminConsole.java +++ b/services/src/main/java/org/keycloak/services/resources/admin/AdminConsole.java @@ -344,6 +344,7 @@ public class AdminConsole { map.put("masterRealm", Config.getAdminRealm()); map.put("resourceVersion", Version.RESOURCES_VERSION); map.put("loginRealm", realm.getName()); + map.put("clientId", Constants.ADMIN_CONSOLE_CLIENT_ID); map.put("properties", theme.getProperties()); FreeMarkerProvider freeMarkerUtil = session.getProvider(FreeMarkerProvider.class);