diff --git a/js/apps/account-ui/pom.xml b/js/apps/account-ui/pom.xml index f1849b7a57..ea6d3f6da5 100644 --- a/js/apps/account-ui/pom.xml +++ b/js/apps/account-ui/pom.xml @@ -77,10 +77,10 @@ { - "loginRealm": "${loginRealm!"master"}", - "authServerUrl": "${authUrl}", - "resourceUrl": "${resourceUrl}", - "isRunningAsTheme": true + "authUrl": "${authUrl}", + "isRunningAsTheme": true, + "realm": "${realm.name}", + "resourceUrl": "${resourceUrl}" } diff --git a/js/apps/account-ui/src/api.ts b/js/apps/account-ui/src/api.ts index c8330cd60c..ea7ed82244 100644 --- a/js/apps/account-ui/src/api.ts +++ b/js/apps/account-ui/src/api.ts @@ -67,9 +67,9 @@ function checkResponse(response: T) { async function get(path: string, params: RequestInit): Promise { const url = joinPath( - environment.authServerUrl, + environment.authUrl, "realms", - environment.loginRealm, + environment.realm, "account", path ); diff --git a/js/apps/account-ui/src/api/methods.ts b/js/apps/account-ui/src/api/methods.ts index 62fd43fda4..f7a7d40817 100644 --- a/js/apps/account-ui/src/api/methods.ts +++ b/js/apps/account-ui/src/api/methods.ts @@ -103,12 +103,7 @@ export async function unLinkAccount(account: LinkedAccountRepresentation) { export async function linkAccount(account: LinkedAccountRepresentation) { const redirectUri = encodeURIComponent( - joinPath( - environment.authServerUrl, - "realms", - environment.loginRealm, - "account" - ) + joinPath(environment.authUrl, "realms", environment.realm, "account") ); const response = await request("/linked-accounts/" + account.providerName, { searchParams: { providerId: account.providerName, redirectUri }, diff --git a/js/apps/account-ui/src/api/request.ts b/js/apps/account-ui/src/api/request.ts index 031404f6bd..14fad416e0 100644 --- a/js/apps/account-ui/src/api/request.ts +++ b/js/apps/account-ui/src/api/request.ts @@ -15,13 +15,7 @@ export async function request( { signal, method, searchParams, body }: RequestOptions = {} ): Promise { const url = new URL( - joinPath( - environment.authServerUrl, - "realms", - environment.loginRealm, - "account", - path - ) + joinPath(environment.authUrl, "realms", environment.realm, "account", path) ); if (searchParams) { diff --git a/js/apps/account-ui/src/environment.ts b/js/apps/account-ui/src/environment.ts index b83006a701..fd1faede83 100644 --- a/js/apps/account-ui/src/environment.ts +++ b/js/apps/account-ui/src/environment.ts @@ -1,20 +1,20 @@ export type Environment = { - /** The realm which should be used when signing into the application. */ - loginRealm: string; /** The URL to the root of the auth server. */ - authServerUrl: string; - /** The URL to resources such as the files in the `public` directory. */ - resourceUrl: string; + authUrl: string; /** Indicates if the application is running as a Keycloak theme. */ isRunningAsTheme: boolean; + /** The realm used to sign into. */ + realm: string; + /** The URL to resources such as the files in the `public` directory. */ + resourceUrl: string; }; // The default environment, used during development. const defaultEnvironment: Environment = { - loginRealm: "master", - authServerUrl: "http://localhost:8180", - resourceUrl: "http://localhost:8080", + authUrl: "http://localhost:8180", isRunningAsTheme: false, + realm: "master", + resourceUrl: "http://localhost:8080", }; // Merge the default and injected environment variables together. diff --git a/js/apps/account-ui/src/keycloak.ts b/js/apps/account-ui/src/keycloak.ts index 52a1b4048f..aa6eb9d66d 100644 --- a/js/apps/account-ui/src/keycloak.ts +++ b/js/apps/account-ui/src/keycloak.ts @@ -2,8 +2,8 @@ import Keycloak from "keycloak-js"; import { environment } from "./environment"; export const keycloak = new Keycloak({ - url: environment.authServerUrl, - realm: environment.loginRealm, + url: environment.authUrl, + realm: environment.realm, clientId: environment.isRunningAsTheme ? "account-console" : "security-admin-console-v2", diff --git a/js/apps/keycloak-server/scripts/start-server.mjs b/js/apps/keycloak-server/scripts/start-server.mjs index db5ef4a927..23c7b55337 100755 --- a/js/apps/keycloak-server/scripts/start-server.mjs +++ b/js/apps/keycloak-server/scripts/start-server.mjs @@ -26,7 +26,7 @@ async function startServer() { [ "start-dev", "--http-port=8180", - "--features=admin2,admin-fine-grained-authz,declarative-user-profile", + "--features=account3,admin-fine-grained-authz,declarative-user-profile", ...args, ], {