From cd0dbdf2647c7328cafb6f9dc194c8196244d432 Mon Sep 17 00:00:00 2001 From: Jon Koops Date: Wed, 26 Jun 2024 16:52:25 +0200 Subject: [PATCH] Use the Keycloak server URL for common resources (#30823) Closes #30541 Signed-off-by: Jon Koops --- .../services/resources/account/AccountConsole.java | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) 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 cebfe97f64..778a5e022a 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 @@ -96,15 +96,9 @@ public class AccountConsole implements AccountResourceProvider { @NoCache @Path("{any:.*}") public Response getMainPage() throws IOException, FreeMarkerException { - // Get the URI info of the server and admin console. final var serverUriInfo = session.getContext().getUri(UrlType.FRONTEND); - final var adminUriInfo = session.getContext().getUri(UrlType.ADMIN); - - // Get the base URLs of the server and admin console. final var serverBaseUri = serverUriInfo.getBaseUri(); - final var adminBaseUri = adminUriInfo.getBaseUri(); - - // Strip any trailing slashes from the URLs. + // Strip any trailing slashes from the URL. final var serverBaseUrl = serverBaseUri.toString().replaceFirst("/+$", ""); final var map = new HashMap(); @@ -124,7 +118,7 @@ public class AccountConsole implements AccountResourceProvider { map.put("realm", realm); map.put("clientId", Constants.ACCOUNT_CONSOLE_CLIENT_ID); map.put("resourceUrl", Urls.themeRoot(serverBaseUri).getPath() + "/" + Constants.ACCOUNT_MANAGEMENT_CLIENT_ID + "/" + theme.getName()); - map.put("resourceCommonUrl", Urls.themeRoot(adminBaseUri).getPath() + "/common/keycloak"); + map.put("resourceCommonUrl", Urls.themeRoot(serverBaseUri).getPath() + "/common/keycloak"); map.put("resourceVersion", Version.RESOURCES_VERSION); String[] referrer = getReferrer();