KEYCLOAK-4737 Admin Console redirect loop when hostname contains console
This commit is contained in:
parent
e54c1d7de1
commit
0a0d2174e4
3 changed files with 5 additions and 8 deletions
|
@ -296,6 +296,7 @@ public class AdminConsole {
|
||||||
authUrl = authUrl.substring(0, authUrl.length() - 1);
|
authUrl = authUrl.substring(0, authUrl.length() - 1);
|
||||||
|
|
||||||
map.put("authUrl", authUrl);
|
map.put("authUrl", authUrl);
|
||||||
|
map.put("consoleBaseUrl", uriInfo.getRequestUri().toString());
|
||||||
map.put("resourceUrl", Urls.themeRoot(baseUri) + "/admin/" + theme.getName());
|
map.put("resourceUrl", Urls.themeRoot(baseUri) + "/admin/" + theme.getName());
|
||||||
map.put("masterRealm", Config.getAdminRealm());
|
map.put("masterRealm", Config.getAdminRealm());
|
||||||
map.put("resourceVersion", Version.RESOURCES_VERSION);
|
map.put("resourceVersion", Version.RESOURCES_VERSION);
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
var authUrl = '${authUrl}';
|
var authUrl = '${authUrl}';
|
||||||
|
var consoleBaseUrl = '${consoleBaseUrl}';
|
||||||
var resourceUrl = '${resourceUrl}';
|
var resourceUrl = '${resourceUrl}';
|
||||||
var masterRealm = '${masterRealm}';
|
var masterRealm = '${masterRealm}';
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -1,10 +1,5 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var consoleBaseUrl = window.location.href;
|
|
||||||
consoleBaseUrl = consoleBaseUrl.substring(0, consoleBaseUrl.indexOf("/console"));
|
|
||||||
consoleBaseUrl = consoleBaseUrl + "/console";
|
|
||||||
var configUrl = consoleBaseUrl + "/config";
|
|
||||||
|
|
||||||
var auth = {};
|
var auth = {};
|
||||||
var resourceBundle;
|
var resourceBundle;
|
||||||
var locale = 'en';
|
var locale = 'en';
|
||||||
|
@ -14,11 +9,11 @@ var resourceRequests = 0;
|
||||||
var loadingTimer = -1;
|
var loadingTimer = -1;
|
||||||
|
|
||||||
angular.element(document).ready(function () {
|
angular.element(document).ready(function () {
|
||||||
var keycloakAuth = new Keycloak(configUrl);
|
var keycloakAuth = new Keycloak(consoleBaseUrl + 'config');
|
||||||
|
|
||||||
function whoAmI(success, error) {
|
function whoAmI(success, error) {
|
||||||
var req = new XMLHttpRequest();
|
var req = new XMLHttpRequest();
|
||||||
req.open('GET', consoleBaseUrl + "/whoami", true);
|
req.open('GET', consoleBaseUrl + 'whoami', true);
|
||||||
req.setRequestHeader('Accept', 'application/json');
|
req.setRequestHeader('Accept', 'application/json');
|
||||||
req.setRequestHeader('Authorization', 'bearer ' + keycloakAuth.token);
|
req.setRequestHeader('Authorization', 'bearer ' + keycloakAuth.token);
|
||||||
|
|
||||||
|
@ -38,7 +33,7 @@ angular.element(document).ready(function () {
|
||||||
|
|
||||||
function loadResourceBundle(success, error) {
|
function loadResourceBundle(success, error) {
|
||||||
var req = new XMLHttpRequest();
|
var req = new XMLHttpRequest();
|
||||||
req.open('GET', consoleBaseUrl + '/messages.json?lang=' + locale, true);
|
req.open('GET', consoleBaseUrl + 'messages.json?lang=' + locale, true);
|
||||||
req.setRequestHeader('Accept', 'application/json');
|
req.setRequestHeader('Accept', 'application/json');
|
||||||
|
|
||||||
req.onreadystatechange = function () {
|
req.onreadystatechange = function () {
|
||||||
|
|
Loading…
Reference in a new issue