diff --git a/admin-ui/src/main/resources/META-INF/resources/admin/index.html b/admin-ui/src/main/resources/META-INF/resources/admin/index.html index 188074d868..e0623362ab 100755 --- a/admin-ui/src/main/resources/META-INF/resources/admin/index.html +++ b/admin-ui/src/main/resources/META-INF/resources/admin/index.html @@ -1,5 +1,5 @@ - +
diff --git a/admin-ui/src/main/resources/META-INF/resources/admin/js/app.js b/admin-ui/src/main/resources/META-INF/resources/admin/js/app.js index 56ce438f90..90bc5ff6f5 100755 --- a/admin-ui/src/main/resources/META-INF/resources/admin/js/app.js +++ b/admin-ui/src/main/resources/META-INF/resources/admin/js/app.js @@ -4,6 +4,23 @@ var module = angular.module('keycloak', [ 'keycloak.services', 'keycloak.loaders var resourceRequests = 0; var loadingTimer = -1; +angular.element(document).ready(function ($http) { + $http.get('/auth-server/rest/saas/whoami').success(function(data) { + var auth = {}; + auth.user = data; + auth.loggedIn = true; + + module.factory('Auth', function() { + return auth; + }); + angular.bootstrap(document, ["keycloak"]); + }).error(function() { + var path = window.location.hash && window.location.hash.substring(1) || '/'; + window.location = '/auth-server/rest/saas/login?path=' + path; + }); +}); + + module.config([ '$routeProvider', function($routeProvider) { $routeProvider diff --git a/admin-ui/src/main/resources/META-INF/resources/admin/js/services.js b/admin-ui/src/main/resources/META-INF/resources/admin/js/services.js index c9cdc413df..bb72402409 100755 --- a/admin-ui/src/main/resources/META-INF/resources/admin/js/services.js +++ b/admin-ui/src/main/resources/META-INF/resources/admin/js/services.js @@ -2,17 +2,6 @@ var module = angular.module('keycloak.services', [ 'ngResource' ]); -module.service('Auth', function() { - var auth = { - loggedIn : false - }; - auth.user = { - userId : null, - displayName : null - }; - return auth; -}); - module.service('Dialog', function($dialog) { var dialog = {};