[KEYCLOAK-17174] - New admin console using wrong base URI for redirection (#7794)
This commit is contained in:
parent
0f30b3118a
commit
2796f62899
1 changed files with 6 additions and 3 deletions
|
@ -82,16 +82,19 @@ public class AccountConsole {
|
||||||
@GET
|
@GET
|
||||||
@NoCache
|
@NoCache
|
||||||
public Response getMainPage() throws IOException, FreeMarkerException {
|
public Response getMainPage() throws IOException, FreeMarkerException {
|
||||||
|
UriInfo uriInfo = session.getContext().getUri(UrlType.FRONTEND);
|
||||||
|
URI accountBaseUrl = uriInfo.getBaseUriBuilder().path(RealmsResource.class).path(realm.getName())
|
||||||
|
.path(Constants.ACCOUNT_MANAGEMENT_CLIENT_ID).path("/").build(realm);
|
||||||
|
|
||||||
if (!session.getContext().getUri().getRequestUri().getPath().endsWith("/")) {
|
if (!session.getContext().getUri().getRequestUri().getPath().endsWith("/")) {
|
||||||
return Response.status(302).location(session.getContext().getUri().getRequestUriBuilder().path("/").build()).build();
|
return Response.status(302).location(accountBaseUrl).build();
|
||||||
} else {
|
} else {
|
||||||
Map<String, Object> map = new HashMap<>();
|
Map<String, Object> map = new HashMap<>();
|
||||||
|
|
||||||
URI adminBaseUri = session.getContext().getUri(UrlType.ADMIN).getBaseUri();
|
URI adminBaseUri = session.getContext().getUri(UrlType.ADMIN).getBaseUri();
|
||||||
UriInfo uriInfo = session.getContext().getUri(UrlType.FRONTEND);
|
|
||||||
URI authUrl = uriInfo.getBaseUri();
|
URI authUrl = uriInfo.getBaseUri();
|
||||||
map.put("authUrl", authUrl.toString());
|
map.put("authUrl", authUrl.toString());
|
||||||
map.put("baseUrl", uriInfo.getBaseUriBuilder().path(RealmsResource.class).path(realm.getName()).path(Constants.ACCOUNT_MANAGEMENT_CLIENT_ID).build(realm).toString());
|
map.put("baseUrl", accountBaseUrl);
|
||||||
map.put("realm", realm);
|
map.put("realm", realm);
|
||||||
map.put("resourceUrl", Urls.themeRoot(authUrl).getPath() + "/" + Constants.ACCOUNT_MANAGEMENT_CLIENT_ID + "/" + theme.getName());
|
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("resourceCommonUrl", Urls.themeRoot(adminBaseUri).getPath() + "/common/keycloak");
|
||||||
|
|
Loading…
Reference in a new issue