From f92ad70ff06de1268d1d59695f6555692d00d97e Mon Sep 17 00:00:00 2001 From: Stian Thorgersen Date: Fri, 21 Apr 2017 14:03:05 +0200 Subject: [PATCH] KEYCLOAK-4774 redirect_fragment doesn't work in Admin Console --- services/src/main/java/org/keycloak/services/Urls.java | 5 +++++ .../org/keycloak/services/resources/admin/AdminConsole.java | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/services/src/main/java/org/keycloak/services/Urls.java b/services/src/main/java/org/keycloak/services/Urls.java index a23a26a0e2..059c84d8bc 100755 --- a/services/src/main/java/org/keycloak/services/Urls.java +++ b/services/src/main/java/org/keycloak/services/Urls.java @@ -25,6 +25,7 @@ import org.keycloak.services.resources.IdentityBrokerService; import org.keycloak.services.resources.LoginActionsService; import org.keycloak.services.resources.RealmsResource; import org.keycloak.services.resources.ThemeResource; +import org.keycloak.services.resources.admin.AdminRoot; import javax.ws.rs.core.UriBuilder; import java.net.URI; @@ -34,6 +35,10 @@ import java.net.URI; */ public class Urls { + public static URI adminConsoleRoot(URI baseUri, String realmId) { + return UriBuilder.fromUri(baseUri).path(AdminRoot.class).path("{realm}/console/").build(realmId); + } + public static URI accountApplicationsPage(URI baseUri, String realmId) { return accountBase(baseUri).path(AccountService.class, "applicationsPage").build(realmId); } 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 4f50397cb5..645afafee0 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 @@ -296,7 +296,7 @@ public class AdminConsole { authUrl = authUrl.substring(0, authUrl.length() - 1); map.put("authUrl", authUrl); - map.put("consoleBaseUrl", uriInfo.getRequestUri().toString()); + map.put("consoleBaseUrl", Urls.adminConsoleRoot(baseUri, realm.getId())); map.put("resourceUrl", Urls.themeRoot(baseUri) + "/admin/" + theme.getName()); map.put("masterRealm", Config.getAdminRealm()); map.put("resourceVersion", Version.RESOURCES_VERSION);