Allow changing base url for Keycloak
This commit is contained in:
parent
abde247e14
commit
948960f33f
12 changed files with 89 additions and 84 deletions
|
@ -29,13 +29,13 @@
|
|||
<script src="lib/angular/select2.js" type="text/javascript"></script>
|
||||
<script src="lib/fileupload/angular-file-upload.min.js"></script>
|
||||
|
||||
<script src="js/app.js"></script>
|
||||
<script src="js/controllers/realm.js"></script>
|
||||
<script src="js/controllers/applications.js"></script>
|
||||
<script src="js/controllers/oauth-clients.js"></script>
|
||||
<script src="js/controllers/users.js"></script>
|
||||
<script src="js/loaders.js"></script>
|
||||
<script src="js/services.js"></script>
|
||||
<script src="js/app.js" type="text/javascript"></script>
|
||||
<script src="js/controllers/realm.js" type="text/javascript"></script>
|
||||
<script src="js/controllers/applications.js" type="text/javascript"></script>
|
||||
<script src="js/controllers/oauth-clients.js" type="text/javascript"></script>
|
||||
<script src="js/controllers/users.js" type="text/javascript"></script>
|
||||
<script src="js/loaders.js" type="text/javascript"></script>
|
||||
<script src="js/services.js" type="text/javascript"></script>
|
||||
|
||||
<style>
|
||||
[ng\:cloak], [ng-cloak], .ng-cloak {
|
||||
|
@ -83,12 +83,12 @@
|
|||
$.idleTimeout('#idletimeout', '#idletimeout a', {
|
||||
idleAfter: 300,
|
||||
pollingInterval: 60,
|
||||
keepAliveURL: '/auth/rest/admin/keepalive',
|
||||
keepAliveURL: authUrl + '/rest/admin/keepalive',
|
||||
serverResponseEquals: '',
|
||||
failedRequests: 1,
|
||||
onTimeout: function(){
|
||||
$(this).slideUp();
|
||||
window.location = "/auth/rest/admin/logout";
|
||||
window.location = authUrl + '/rest/admin/logout';
|
||||
},
|
||||
onIdle: function(){
|
||||
$(this).slideDown(); // show the warning bar
|
||||
|
|
|
@ -1,11 +1,14 @@
|
|||
'use strict';
|
||||
|
||||
var authUrl = window.location.href;
|
||||
authUrl = authUrl.substring(0, authUrl.indexOf('/admin/'));
|
||||
|
||||
var module = angular.module('keycloak', [ 'keycloak.services', 'keycloak.loaders', 'ui.bootstrap', 'ui.select2', 'angularFileUpload' ]);
|
||||
var resourceRequests = 0;
|
||||
var loadingTimer = -1;
|
||||
|
||||
angular.element(document).ready(function ($http) {
|
||||
$http.get('/auth/rest/admin/whoami').success(function(data) {
|
||||
$http.get(authUrl + '/rest/admin/whoami').success(function(data) {
|
||||
var auth = {};
|
||||
auth.user = data;
|
||||
auth.loggedIn = true;
|
||||
|
@ -16,7 +19,7 @@ angular.element(document).ready(function ($http) {
|
|||
angular.bootstrap(document, ["keycloak"]);
|
||||
}).error(function() {
|
||||
var path = window.location.hash && window.location.hash.substring(1) || '/';
|
||||
window.location = '/auth/rest/admin/login?path=' + path;
|
||||
window.location = authUrl + '/rest/admin/login?path=' + path;
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -666,7 +669,7 @@ module.factory('errorInterceptor', function($q, $window, $rootScope, $location,
|
|||
if (response.status == 401) {
|
||||
console.log('session timeout?');
|
||||
Auth.loggedIn = false;
|
||||
window.location = '/auth/rest/admin/login?path=' + $location.path();
|
||||
window.location = authUrl + '/rest/admin/login?path=' + $location.path();
|
||||
} else if (response.status == 403) {
|
||||
Notifications.error("Forbidden");
|
||||
} else if (response.status == 404) {
|
||||
|
|
|
@ -361,7 +361,7 @@ module.controller('ApplicationScopeMappingCtrl', function($scope, $http, realm,
|
|||
});
|
||||
|
||||
$scope.addRealmRole = function() {
|
||||
$http.post('/auth/rest/admin/realms/' + realm.realm + '/applications/' + application.name + '/scope-mappings/realm',
|
||||
$http.post(authUrl + '/rest/admin/realms/' + realm.realm + '/applications/' + application.name + '/scope-mappings/realm',
|
||||
$scope.selectedRealmRoles).success(function() {
|
||||
for (var i = 0; i < $scope.selectedRealmRoles.length; i++) {
|
||||
var role = $scope.selectedRealmRoles[i];
|
||||
|
@ -376,7 +376,7 @@ module.controller('ApplicationScopeMappingCtrl', function($scope, $http, realm,
|
|||
};
|
||||
|
||||
$scope.deleteRealmRole = function() {
|
||||
$http.delete('/auth/rest/admin/realms/' + realm.realm + '/applications/' + application.name + '/scope-mappings/realm',
|
||||
$http.delete(authUrl + '/rest/admin/realms/' + realm.realm + '/applications/' + application.name + '/scope-mappings/realm',
|
||||
{data : $scope.selectedRealmMappings, headers : {"content-type" : "application/json"}}).success(function() {
|
||||
for (var i = 0; i < $scope.selectedRealmMappings.length; i++) {
|
||||
var role = $scope.selectedRealmMappings[i];
|
||||
|
@ -391,7 +391,7 @@ module.controller('ApplicationScopeMappingCtrl', function($scope, $http, realm,
|
|||
};
|
||||
|
||||
$scope.addApplicationRole = function() {
|
||||
$http.post('/auth/rest/admin/realms/' + realm.realm + '/applications/' + application.name + '/scope-mappings/applications/' + $scope.targetApp.name,
|
||||
$http.post(authUrl + '/rest/admin/realms/' + realm.realm + '/applications/' + application.name + '/scope-mappings/applications/' + $scope.targetApp.name,
|
||||
$scope.selectedApplicationRoles).success(function() {
|
||||
for (var i = 0; i < $scope.selectedApplicationRoles.length; i++) {
|
||||
var role = $scope.selectedApplicationRoles[i];
|
||||
|
@ -406,7 +406,7 @@ module.controller('ApplicationScopeMappingCtrl', function($scope, $http, realm,
|
|||
};
|
||||
|
||||
$scope.deleteApplicationRole = function() {
|
||||
$http.delete('/auth/rest/admin/realms/' + realm.realm + '/applications/' + application.name + '/scope-mappings/applications/' + $scope.targetApp.name,
|
||||
$http.delete(authUrl + '/rest/admin/realms/' + realm.realm + '/applications/' + application.name + '/scope-mappings/applications/' + $scope.targetApp.name,
|
||||
{data : $scope.selectedApplicationMappings, headers : {"content-type" : "application/json"}}).success(function() {
|
||||
for (var i = 0; i < $scope.selectedApplicationMappings.length; i++) {
|
||||
var role = $scope.selectedApplicationMappings[i];
|
||||
|
|
|
@ -211,7 +211,7 @@ module.controller('OAuthClientScopeMappingCtrl', function($scope, $http, realm,
|
|||
});
|
||||
|
||||
$scope.addRealmRole = function() {
|
||||
$http.post('/auth/rest/admin/realms/' + realm.realm + '/oauth-clients/' + oauth.id + '/scope-mappings/realm',
|
||||
$http.post(authUrl + '/rest/admin/realms/' + realm.realm + '/oauth-clients/' + oauth.id + '/scope-mappings/realm',
|
||||
$scope.selectedRealmRoles).success(function() {
|
||||
for (var i = 0; i < $scope.selectedRealmRoles.length; i++) {
|
||||
var role = $scope.selectedRealmRoles[i];
|
||||
|
@ -226,7 +226,7 @@ module.controller('OAuthClientScopeMappingCtrl', function($scope, $http, realm,
|
|||
};
|
||||
|
||||
$scope.deleteRealmRole = function() {
|
||||
$http.delete('/auth/rest/admin/realms/' + realm.realm + '/oauth-clients/' + oauth.id + '/scope-mappings/realm',
|
||||
$http.delete(authUrl + '/rest/admin/realms/' + realm.realm + '/oauth-clients/' + oauth.id + '/scope-mappings/realm',
|
||||
{data : $scope.selectedRealmMappings, headers : {"content-type" : "application/json"}}).success(function() {
|
||||
for (var i = 0; i < $scope.selectedRealmMappings.length; i++) {
|
||||
var role = $scope.selectedRealmMappings[i];
|
||||
|
@ -241,7 +241,7 @@ module.controller('OAuthClientScopeMappingCtrl', function($scope, $http, realm,
|
|||
};
|
||||
|
||||
$scope.addApplicationRole = function() {
|
||||
$http.post('/auth/rest/admin/realms/' + realm.realm + '/oauth-clients/' + oauth.id + '/scope-mappings/applications/' + $scope.targetApp.name,
|
||||
$http.post(authUrl + '/rest/admin/realms/' + realm.realm + '/oauth-clients/' + oauth.id + '/scope-mappings/applications/' + $scope.targetApp.name,
|
||||
$scope.selectedApplicationRoles).success(function() {
|
||||
for (var i = 0; i < $scope.selectedApplicationRoles.length; i++) {
|
||||
var role = $scope.selectedApplicationRoles[i];
|
||||
|
@ -256,7 +256,7 @@ module.controller('OAuthClientScopeMappingCtrl', function($scope, $http, realm,
|
|||
};
|
||||
|
||||
$scope.deleteApplicationRole = function() {
|
||||
$http.delete('/auth/rest/admin/realms/' + realm.realm + '/oauth-clients/' + oauth.id + '/scope-mappings/applications/' + $scope.targetApp.name,
|
||||
$http.delete(authUrl + '/rest/admin/realms/' + realm.realm + '/oauth-clients/' + oauth.id + '/scope-mappings/applications/' + $scope.targetApp.name,
|
||||
{data : $scope.selectedApplicationMappings, headers : {"content-type" : "application/json"}}).success(function() {
|
||||
for (var i = 0; i < $scope.selectedApplicationMappings.length; i++) {
|
||||
var role = $scope.selectedApplicationMappings[i];
|
||||
|
|
|
@ -3,8 +3,10 @@ module.controller('GlobalCtrl', function($scope, $http, Auth, Current, $location
|
|||
Notifications.success("test");
|
||||
};
|
||||
|
||||
$scope.authUrl = authUrl;
|
||||
|
||||
$scope.auth = Auth;
|
||||
$http.get('/auth/rest/admin/whoami').success(function(data, status) {
|
||||
$http.get(authUrl + '/rest/admin/whoami').success(function(data, status) {
|
||||
Auth.user = data;
|
||||
Auth.loggedIn = true;
|
||||
|
||||
|
@ -148,7 +150,7 @@ module.controller('RealmCreateCtrl', function($scope, Current, Realm, $upload, $
|
|||
for (var i = 0; i < $scope.files.length; i++) {
|
||||
var $file = $scope.files[i];
|
||||
$scope.upload = $upload.upload({
|
||||
url: '/auth/rest/admin/realms', //upload.php script, node.js route, or servlet url
|
||||
url: authUrl + '/rest/admin/realms', //upload.php script, node.js route, or servlet url
|
||||
// method: POST or PUT,
|
||||
// headers: {'headerKey': 'headerValue'}, withCredential: true,
|
||||
data: {myObj: ""},
|
||||
|
@ -163,7 +165,7 @@ module.controller('RealmCreateCtrl', function($scope, Current, Realm, $upload, $
|
|||
Realm.query(function(data) {
|
||||
Current.realms = data;
|
||||
|
||||
$http.get('/auth/rest/admin/whoami').success(function(user) {
|
||||
$http.get(authUrl + '/rest/admin/whoami').success(function(user) {
|
||||
Auth.user = user;
|
||||
|
||||
Notifications.success("The realm has been uploaded.");
|
||||
|
@ -200,7 +202,7 @@ module.controller('RealmCreateCtrl', function($scope, Current, Realm, $upload, $
|
|||
Realm.query(function(data) {
|
||||
Current.realms = data;
|
||||
|
||||
$http.get('/auth/rest/admin/whoami').success(function(user) {
|
||||
$http.get(authUrl + '/rest/admin/whoami').success(function(user) {
|
||||
Auth.user = user;
|
||||
|
||||
$location.url("/realms/" + realmCopy.realm);
|
||||
|
|
|
@ -28,7 +28,7 @@ module.controller('UserRoleMappingCtrl', function($scope, $http, realm, user, ro
|
|||
});
|
||||
|
||||
$scope.addRealmRole = function() {
|
||||
$http.post('/auth/rest/admin/realms/' + realm.realm + '/users/' + user.username + '/role-mappings/realm',
|
||||
$http.post(authUrl + '/rest/admin/realms/' + realm.realm + '/users/' + user.username + '/role-mappings/realm',
|
||||
$scope.selectedRealmRoles).success(function() {
|
||||
for (var i = 0; i < $scope.selectedRealmRoles.length; i++) {
|
||||
var role = $scope.selectedRealmRoles[i];
|
||||
|
@ -43,7 +43,7 @@ module.controller('UserRoleMappingCtrl', function($scope, $http, realm, user, ro
|
|||
};
|
||||
|
||||
$scope.deleteRealmRole = function() {
|
||||
$http.delete('/auth/rest/admin/realms/' + realm.realm + '/users/' + user.username + '/role-mappings/realm',
|
||||
$http.delete(authUrl + '/rest/admin/realms/' + realm.realm + '/users/' + user.username + '/role-mappings/realm',
|
||||
{data : $scope.selectedRealmMappings, headers : {"content-type" : "application/json"}}).success(function() {
|
||||
for (var i = 0; i < $scope.selectedRealmMappings.length; i++) {
|
||||
var role = $scope.selectedRealmMappings[i];
|
||||
|
@ -58,7 +58,7 @@ module.controller('UserRoleMappingCtrl', function($scope, $http, realm, user, ro
|
|||
};
|
||||
|
||||
$scope.addApplicationRole = function() {
|
||||
$http.post('/auth/rest/admin/realms/' + realm.realm + '/users/' + user.username + '/role-mappings/applications/' + $scope.application.name,
|
||||
$http.post(authUrl + '/rest/admin/realms/' + realm.realm + '/users/' + user.username + '/role-mappings/applications/' + $scope.application.name,
|
||||
$scope.selectedApplicationRoles).success(function() {
|
||||
for (var i = 0; i < $scope.selectedApplicationRoles.length; i++) {
|
||||
var role = $scope.selectedApplicationRoles[i];
|
||||
|
@ -73,7 +73,7 @@ module.controller('UserRoleMappingCtrl', function($scope, $http, realm, user, ro
|
|||
};
|
||||
|
||||
$scope.deleteApplicationRole = function() {
|
||||
$http.delete('/auth/rest/admin/realms/' + realm.realm + '/users/' + user.username + '/role-mappings/applications/' + $scope.application.name,
|
||||
$http.delete(authUrl + '/rest/admin/realms/' + realm.realm + '/users/' + user.username + '/role-mappings/applications/' + $scope.application.name,
|
||||
{data : $scope.selectedApplicationMappings, headers : {"content-type" : "application/json"}}).success(function() {
|
||||
for (var i = 0; i < $scope.selectedApplicationMappings.length; i++) {
|
||||
var role = $scope.selectedApplicationMappings[i];
|
||||
|
|
|
@ -128,7 +128,7 @@ module.factory('Notifications', function($rootScope, $timeout) {
|
|||
});
|
||||
|
||||
module.factory('Realm', function($resource) {
|
||||
return $resource('/auth/rest/admin/realms/:id', {
|
||||
return $resource(authUrl + '/rest/admin/realms/:id', {
|
||||
id : '@realm'
|
||||
}, {
|
||||
update : {
|
||||
|
@ -143,17 +143,17 @@ module.factory('Realm', function($resource) {
|
|||
});
|
||||
|
||||
module.factory('RealmAudit', function($resource) {
|
||||
return $resource('/auth/rest/admin/realms/:id/audit', {
|
||||
return $resource(authUrl + '/rest/admin/realms/:id/audit', {
|
||||
id : '@realm'
|
||||
});
|
||||
});
|
||||
|
||||
module.factory('ServerInfo', function($resource) {
|
||||
return $resource('/auth/rest/admin/serverinfo');
|
||||
return $resource(authUrl + '/rest/admin/serverinfo');
|
||||
});
|
||||
|
||||
module.factory('User', function($resource) {
|
||||
return $resource('/auth/rest/admin/realms/:realm/users/:userId', {
|
||||
return $resource(authUrl + '/rest/admin/realms/:realm/users/:userId', {
|
||||
realm : '@realm',
|
||||
userId : '@userId'
|
||||
}, {
|
||||
|
@ -164,13 +164,13 @@ module.factory('User', function($resource) {
|
|||
});
|
||||
|
||||
module.factory('UserSessionStats', function($resource) {
|
||||
return $resource('/auth/rest/admin/realms/:realm/users/:user/session-stats', {
|
||||
return $resource(authUrl + '/rest/admin/realms/:realm/users/:user/session-stats', {
|
||||
realm : '@realm',
|
||||
user : '@user'
|
||||
});
|
||||
});
|
||||
module.factory('UserLogout', function($resource) {
|
||||
return $resource('/auth/rest/admin/realms/:realm/users/:user/logout', {
|
||||
return $resource(authUrl + '/rest/admin/realms/:realm/users/:user/logout', {
|
||||
realm : '@realm',
|
||||
user : '@user'
|
||||
});
|
||||
|
@ -179,7 +179,7 @@ module.factory('UserLogout', function($resource) {
|
|||
module.factory('UserCredentials', function($resource) {
|
||||
var credentials = {};
|
||||
|
||||
credentials.resetPassword = $resource('/auth/rest/admin/realms/:realm/users/:userId/reset-password', {
|
||||
credentials.resetPassword = $resource(authUrl + '/rest/admin/realms/:realm/users/:userId/reset-password', {
|
||||
realm : '@realm',
|
||||
userId : '@userId'
|
||||
}, {
|
||||
|
@ -188,7 +188,7 @@ module.factory('UserCredentials', function($resource) {
|
|||
}
|
||||
}).update;
|
||||
|
||||
credentials.removeTotp = $resource('/auth/rest/admin/realms/:realm/users/:userId/remove-totp', {
|
||||
credentials.removeTotp = $resource(authUrl + '/rest/admin/realms/:realm/users/:userId/remove-totp', {
|
||||
realm : '@realm',
|
||||
userId : '@userId'
|
||||
}, {
|
||||
|
@ -197,7 +197,7 @@ module.factory('UserCredentials', function($resource) {
|
|||
}
|
||||
}).update;
|
||||
|
||||
credentials.resetPasswordEmail = $resource('/auth/rest/admin/realms/:realm/users/:userId/reset-password-email', {
|
||||
credentials.resetPasswordEmail = $resource(authUrl + '/rest/admin/realms/:realm/users/:userId/reset-password-email', {
|
||||
realm : '@realm',
|
||||
userId : '@userId'
|
||||
}, {
|
||||
|
@ -210,14 +210,14 @@ module.factory('UserCredentials', function($resource) {
|
|||
});
|
||||
|
||||
module.factory('RealmRoleMapping', function($resource) {
|
||||
return $resource('/auth/rest/admin/realms/:realm/users/:userId/role-mappings/realm', {
|
||||
return $resource(authUrl + '/rest/admin/realms/:realm/users/:userId/role-mappings/realm', {
|
||||
realm : '@realm',
|
||||
userId : '@userId'
|
||||
});
|
||||
});
|
||||
|
||||
module.factory('ApplicationRoleMapping', function($resource) {
|
||||
return $resource('/auth/rest/admin/realms/:realm/users/:userId/role-mappings/applications/:application', {
|
||||
return $resource(authUrl + '/rest/admin/realms/:realm/users/:userId/role-mappings/applications/:application', {
|
||||
realm : '@realm',
|
||||
userId : '@userId',
|
||||
application : "@application"
|
||||
|
@ -225,14 +225,14 @@ module.factory('ApplicationRoleMapping', function($resource) {
|
|||
});
|
||||
|
||||
module.factory('ApplicationRealmScopeMapping', function($resource) {
|
||||
return $resource('/auth/rest/admin/realms/:realm/applications/:application/scope-mappings/realm', {
|
||||
return $resource(authUrl + '/rest/admin/realms/:realm/applications/:application/scope-mappings/realm', {
|
||||
realm : '@realm',
|
||||
application : '@application'
|
||||
});
|
||||
});
|
||||
|
||||
module.factory('ApplicationApplicationScopeMapping', function($resource) {
|
||||
return $resource('/auth/rest/admin/realms/:realm/applications/:application/scope-mappings/applications/:targetApp', {
|
||||
return $resource(authUrl + '/rest/admin/realms/:realm/applications/:application/scope-mappings/applications/:targetApp', {
|
||||
realm : '@realm',
|
||||
application : '@application',
|
||||
targetApp : '@targetApp'
|
||||
|
@ -242,33 +242,33 @@ module.factory('ApplicationApplicationScopeMapping', function($resource) {
|
|||
|
||||
|
||||
module.factory('RealmRoles', function($resource) {
|
||||
return $resource('/auth/rest/admin/realms/:realm/roles', {
|
||||
return $resource(authUrl + '/rest/admin/realms/:realm/roles', {
|
||||
realm : '@realm'
|
||||
});
|
||||
});
|
||||
|
||||
module.factory('RoleRealmComposites', function($resource) {
|
||||
return $resource('/auth/rest/admin/realms/:realm/roles-by-id/:role/composites/realm', {
|
||||
return $resource(authUrl + '/rest/admin/realms/:realm/roles-by-id/:role/composites/realm', {
|
||||
realm : '@realm',
|
||||
role : '@role'
|
||||
});
|
||||
});
|
||||
|
||||
module.factory('RealmPushRevocation', function($resource) {
|
||||
return $resource('/auth/rest/admin/realms/:realm/push-revocation', {
|
||||
return $resource(authUrl + '/rest/admin/realms/:realm/push-revocation', {
|
||||
realm : '@realm'
|
||||
});
|
||||
});
|
||||
|
||||
module.factory('RealmSessionStats', function($resource) {
|
||||
return $resource('/auth/rest/admin/realms/:realm/session-stats', {
|
||||
return $resource(authUrl + '/rest/admin/realms/:realm/session-stats', {
|
||||
realm : '@realm'
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
module.factory('RoleApplicationComposites', function($resource) {
|
||||
return $resource('/auth/rest/admin/realms/:realm/roles-by-id/:role/composites/applications/:application', {
|
||||
return $resource(authUrl + '/rest/admin/realms/:realm/roles-by-id/:role/composites/applications/:application', {
|
||||
realm : '@realm',
|
||||
role : '@role',
|
||||
application : "@application"
|
||||
|
@ -351,7 +351,7 @@ function roleControl($scope, realm, role, roles, applications,
|
|||
|
||||
$scope.addRealmRole = function() {
|
||||
$scope.compositeSwitchDisabled=true;
|
||||
$http.post('/auth/rest/admin/realms/' + realm.realm + '/roles-by-id/' + role.id + '/composites',
|
||||
$http.post(authUrl + '/rest/admin/realms/' + realm.realm + '/roles-by-id/' + role.id + '/composites',
|
||||
$scope.selectedRealmRoles).success(function() {
|
||||
for (var i = 0; i < $scope.selectedRealmRoles.length; i++) {
|
||||
var role = $scope.selectedRealmRoles[i];
|
||||
|
@ -367,7 +367,7 @@ function roleControl($scope, realm, role, roles, applications,
|
|||
|
||||
$scope.deleteRealmRole = function() {
|
||||
$scope.compositeSwitchDisabled=true;
|
||||
$http.delete('/auth/rest/admin/realms/' + realm.realm + '/roles-by-id/' + role.id + '/composites',
|
||||
$http.delete(authUrl + '/rest/admin/realms/' + realm.realm + '/roles-by-id/' + role.id + '/composites',
|
||||
{data : $scope.selectedRealmMappings, headers : {"content-type" : "application/json"}}).success(function() {
|
||||
for (var i = 0; i < $scope.selectedRealmMappings.length; i++) {
|
||||
var role = $scope.selectedRealmMappings[i];
|
||||
|
@ -383,7 +383,7 @@ function roleControl($scope, realm, role, roles, applications,
|
|||
|
||||
$scope.addApplicationRole = function() {
|
||||
$scope.compositeSwitchDisabled=true;
|
||||
$http.post('/auth/rest/admin/realms/' + realm.realm + '/roles-by-id/' + role.id + '/composites',
|
||||
$http.post(authUrl + '/rest/admin/realms/' + realm.realm + '/roles-by-id/' + role.id + '/composites',
|
||||
$scope.selectedApplicationRoles).success(function() {
|
||||
for (var i = 0; i < $scope.selectedApplicationRoles.length; i++) {
|
||||
var role = $scope.selectedApplicationRoles[i];
|
||||
|
@ -399,7 +399,7 @@ function roleControl($scope, realm, role, roles, applications,
|
|||
|
||||
$scope.deleteApplicationRole = function() {
|
||||
$scope.compositeSwitchDisabled=true;
|
||||
$http.delete('/auth/rest/admin/realms/' + realm.realm + '/roles-by-id/' + role.id + '/composites',
|
||||
$http.delete(authUrl + '/rest/admin/realms/' + realm.realm + '/roles-by-id/' + role.id + '/composites',
|
||||
{data : $scope.selectedApplicationMappings, headers : {"content-type" : "application/json"}}).success(function() {
|
||||
for (var i = 0; i < $scope.selectedApplicationMappings.length; i++) {
|
||||
var role = $scope.selectedApplicationMappings[i];
|
||||
|
@ -450,7 +450,7 @@ function roleControl($scope, realm, role, roles, applications,
|
|||
|
||||
|
||||
module.factory('Role', function($resource) {
|
||||
return $resource('/auth/rest/admin/realms/:realm/roles/:role', {
|
||||
return $resource(authUrl + '/rest/admin/realms/:realm/roles/:role', {
|
||||
realm : '@realm',
|
||||
role : '@role'
|
||||
}, {
|
||||
|
@ -461,7 +461,7 @@ module.factory('Role', function($resource) {
|
|||
});
|
||||
|
||||
module.factory('RoleById', function($resource) {
|
||||
return $resource('/auth/rest/admin/realms/:realm/roles-by-id/:role', {
|
||||
return $resource(authUrl + '/rest/admin/realms/:realm/roles-by-id/:role', {
|
||||
realm : '@realm',
|
||||
role : '@role'
|
||||
}, {
|
||||
|
@ -472,7 +472,7 @@ module.factory('RoleById', function($resource) {
|
|||
});
|
||||
|
||||
module.factory('ApplicationRole', function($resource) {
|
||||
return $resource('/auth/rest/admin/realms/:realm/applications/:application/roles/:role', {
|
||||
return $resource(authUrl + '/rest/admin/realms/:realm/applications/:application/roles/:role', {
|
||||
realm : '@realm',
|
||||
application : "@application",
|
||||
role : '@role'
|
||||
|
@ -484,7 +484,7 @@ module.factory('ApplicationRole', function($resource) {
|
|||
});
|
||||
|
||||
module.factory('ApplicationClaims', function($resource) {
|
||||
return $resource('/auth/rest/admin/realms/:realm/applications/:application/claims', {
|
||||
return $resource(authUrl + '/rest/admin/realms/:realm/applications/:application/claims', {
|
||||
realm : '@realm',
|
||||
application : "@application"
|
||||
}, {
|
||||
|
@ -495,40 +495,40 @@ module.factory('ApplicationClaims', function($resource) {
|
|||
});
|
||||
|
||||
module.factory('ApplicationSessionStats', function($resource) {
|
||||
return $resource('/auth/rest/admin/realms/:realm/applications/:application/session-stats', {
|
||||
return $resource(authUrl + '/rest/admin/realms/:realm/applications/:application/session-stats', {
|
||||
realm : '@realm',
|
||||
application : "@application"
|
||||
});
|
||||
});
|
||||
|
||||
module.factory('ApplicationSessionStatsWithUsers', function($resource) {
|
||||
return $resource('/auth/rest/admin/realms/:realm/applications/:application/session-stats?users=true', {
|
||||
return $resource(authUrl + '/rest/admin/realms/:realm/applications/:application/session-stats?users=true', {
|
||||
realm : '@realm',
|
||||
application : "@application"
|
||||
});
|
||||
});
|
||||
|
||||
module.factory('ApplicationLogoutAll', function($resource) {
|
||||
return $resource('/auth/rest/admin/realms/:realm/applications/:application/logout-all', {
|
||||
return $resource(authUrl + '/rest/admin/realms/:realm/applications/:application/logout-all', {
|
||||
realm : '@realm',
|
||||
application : "@application"
|
||||
});
|
||||
});
|
||||
module.factory('ApplicationLogoutUser', function($resource) {
|
||||
return $resource('/auth/rest/admin/realms/:realm/applications/:application/logout-user/:user', {
|
||||
return $resource(authUrl + '/rest/admin/realms/:realm/applications/:application/logout-user/:user', {
|
||||
realm : '@realm',
|
||||
application : "@application",
|
||||
user : "@user"
|
||||
});
|
||||
});
|
||||
module.factory('RealmLogoutAll', function($resource) {
|
||||
return $resource('/auth/rest/admin/realms/:realm/logout-all', {
|
||||
return $resource(authUrl + '/rest/admin/realms/:realm/logout-all', {
|
||||
realm : '@realm'
|
||||
});
|
||||
});
|
||||
|
||||
module.factory('ApplicationPushRevocation', function($resource) {
|
||||
return $resource('/auth/rest/admin/realms/:realm/applications/:application/push-revocation', {
|
||||
return $resource(authUrl + '/rest/admin/realms/:realm/applications/:application/push-revocation', {
|
||||
realm : '@realm',
|
||||
application : "@application"
|
||||
});
|
||||
|
@ -537,7 +537,7 @@ module.factory('ApplicationPushRevocation', function($resource) {
|
|||
|
||||
|
||||
module.factory('Application', function($resource) {
|
||||
return $resource('/auth/rest/admin/realms/:realm/applications/:application', {
|
||||
return $resource(authUrl + '/rest/admin/realms/:realm/applications/:application', {
|
||||
realm : '@realm',
|
||||
application : '@application'
|
||||
}, {
|
||||
|
@ -548,7 +548,7 @@ module.factory('Application', function($resource) {
|
|||
});
|
||||
|
||||
module.factory('ApplicationInstallation', function($resource) {
|
||||
var url = '/auth/rest/admin/realms/:realm/applications/:application/installation/json';
|
||||
var url = authUrl + '/rest/admin/realms/:realm/applications/:application/installation/json';
|
||||
return {
|
||||
url : function(parameters)
|
||||
{
|
||||
|
@ -557,7 +557,7 @@ module.factory('ApplicationInstallation', function($resource) {
|
|||
}
|
||||
});
|
||||
module.factory('ApplicationInstallationJBoss', function($resource) {
|
||||
var url = '/auth/rest/admin/realms/:realm/applications/:application/installation/jboss';
|
||||
var url = authUrl + '/rest/admin/realms/:realm/applications/:application/installation/jboss';
|
||||
return {
|
||||
url : function(parameters)
|
||||
{
|
||||
|
@ -567,7 +567,7 @@ module.factory('ApplicationInstallationJBoss', function($resource) {
|
|||
});
|
||||
|
||||
module.factory('ApplicationCredentials', function($resource) {
|
||||
return $resource('/auth/rest/admin/realms/:realm/applications/:application/client-secret', {
|
||||
return $resource(authUrl + '/rest/admin/realms/:realm/applications/:application/client-secret', {
|
||||
realm : '@realm',
|
||||
application : '@application'
|
||||
}, {
|
||||
|
@ -578,7 +578,7 @@ module.factory('ApplicationCredentials', function($resource) {
|
|||
});
|
||||
|
||||
module.factory('ApplicationOrigins', function($resource) {
|
||||
return $resource('/auth/rest/admin/realms/:realm/applications/:application/allowed-origins', {
|
||||
return $resource(authUrl + '/rest/admin/realms/:realm/applications/:application/allowed-origins', {
|
||||
realm : '@realm',
|
||||
application : '@application'
|
||||
}, {
|
||||
|
@ -590,7 +590,7 @@ module.factory('ApplicationOrigins', function($resource) {
|
|||
});
|
||||
|
||||
module.factory('OAuthClient', function($resource) {
|
||||
return $resource('/auth/rest/admin/realms/:realm/oauth-clients/:id', {
|
||||
return $resource(authUrl + '/rest/admin/realms/:realm/oauth-clients/:id', {
|
||||
realm : '@realm',
|
||||
id : '@id'
|
||||
}, {
|
||||
|
@ -601,7 +601,7 @@ module.factory('OAuthClient', function($resource) {
|
|||
});
|
||||
|
||||
module.factory('OAuthClientClaims', function($resource) {
|
||||
return $resource('/auth/rest/admin/realms/:realm/oauth-clients/:oauth/claims', {
|
||||
return $resource(authUrl + '/rest/admin/realms/:realm/oauth-clients/:oauth/claims', {
|
||||
realm : '@realm',
|
||||
oauth : "@oauth"
|
||||
}, {
|
||||
|
@ -613,7 +613,7 @@ module.factory('OAuthClientClaims', function($resource) {
|
|||
|
||||
|
||||
module.factory('OAuthClientCredentials', function($resource) {
|
||||
return $resource('/auth/rest/admin/realms/:realm/oauth-clients/:oauth/client-secret', {
|
||||
return $resource(authUrl + '/rest/admin/realms/:realm/oauth-clients/:oauth/client-secret', {
|
||||
realm : '@realm',
|
||||
oauth : '@oauth'
|
||||
}, {
|
||||
|
@ -625,14 +625,14 @@ module.factory('OAuthClientCredentials', function($resource) {
|
|||
});
|
||||
|
||||
module.factory('OAuthClientRealmScopeMapping', function($resource) {
|
||||
return $resource('/auth/rest/admin/realms/:realm/oauth-clients/:oauth/scope-mappings/realm', {
|
||||
return $resource(authUrl + '/rest/admin/realms/:realm/oauth-clients/:oauth/scope-mappings/realm', {
|
||||
realm : '@realm',
|
||||
oauth : '@oauth'
|
||||
});
|
||||
});
|
||||
|
||||
module.factory('OAuthClientApplicationScopeMapping', function($resource) {
|
||||
return $resource('/auth/rest/admin/realms/:realm/oauth-clients/:oauth/scope-mappings/applications/:targetApp', {
|
||||
return $resource(authUrl + '/rest/admin/realms/:realm/oauth-clients/:oauth/scope-mappings/applications/:targetApp', {
|
||||
realm : '@realm',
|
||||
oauth : '@oauth',
|
||||
targetApp : '@targetApp'
|
||||
|
@ -640,8 +640,8 @@ module.factory('OAuthClientApplicationScopeMapping', function($resource) {
|
|||
});
|
||||
|
||||
module.factory('OAuthClientInstallation', function($resource) {
|
||||
var url = '/auth/rest/admin/realms/:realm/oauth-clients/:oauth/installation';
|
||||
var resource = $resource('/auth/rest/admin/realms/:realm/oauth-clients/:oauth/installation', {
|
||||
var url = authUrl + '/rest/admin/realms/:realm/oauth-clients/:oauth/installation';
|
||||
var resource = $resource(authUrl + '/rest/admin/realms/:realm/oauth-clients/:oauth/installation', {
|
||||
realm : '@realm',
|
||||
oauth : '@oauth'
|
||||
}, {
|
||||
|
|
|
@ -19,8 +19,8 @@
|
|||
{{auth.user.displayName}}<b class="caret"></b>
|
||||
</a>
|
||||
<ul class="dropdown-menu">
|
||||
<li><a href="/auth/rest/realms/{{auth.user.realm}}/account?referrer=admin-console">Manage Account</a></li>
|
||||
<li class="separator"><a href="/auth/rest/admin/logout">Sign Out</a></li>
|
||||
<li><a href="{{authUrl}}/rest/realms/{{auth.user.realm}}/account?referrer=admin-console">Manage Account</a></li>
|
||||
<li class="separator"><a href="{{authUrl}}/rest/admin/logout">Sign Out</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
|
|
@ -34,7 +34,7 @@ public class AbstractModelTest {
|
|||
identitySession.getTransaction().begin();
|
||||
realmManager = new RealmManager(identitySession);
|
||||
|
||||
new ApplianceBootstrap().bootstrap(identitySession);
|
||||
new ApplianceBootstrap().bootstrap(identitySession, "/auth");
|
||||
}
|
||||
|
||||
@After
|
||||
|
|
|
@ -26,12 +26,12 @@ public class ApplianceBootstrap {
|
|||
|
||||
private static final Logger logger = Logger.getLogger(ApplianceBootstrap.class);
|
||||
|
||||
public void bootstrap(KeycloakSessionFactory factory) {
|
||||
public void bootstrap(KeycloakSessionFactory factory, String contextPath) {
|
||||
KeycloakSession session = factory.createSession();
|
||||
session.getTransaction().begin();
|
||||
|
||||
try {
|
||||
bootstrap(session);
|
||||
bootstrap(session, contextPath);
|
||||
session.getTransaction().commit();
|
||||
} finally {
|
||||
session.close();
|
||||
|
@ -39,7 +39,7 @@ public class ApplianceBootstrap {
|
|||
|
||||
}
|
||||
|
||||
public void bootstrap(KeycloakSession session) {
|
||||
public void bootstrap(KeycloakSession session, String contextPath) {
|
||||
if (session.getRealm(Config.getAdminRealm()) != null) {
|
||||
return;
|
||||
}
|
||||
|
@ -64,7 +64,7 @@ public class ApplianceBootstrap {
|
|||
realm.setAuthenticationProviders(Arrays.asList(AuthenticationProviderModel.DEFAULT_PROVIDER));
|
||||
|
||||
ApplicationModel adminConsole = new ApplicationManager(manager).createApplication(realm, Constants.ADMIN_CONSOLE_APPLICATION);
|
||||
adminConsole.setBaseUrl("/auth/admin/index.html");
|
||||
adminConsole.setBaseUrl(contextPath + "/admin/index.html");
|
||||
adminConsole.setEnabled(true);
|
||||
|
||||
realm.setAuditListeners(Collections.singleton("jboss-logging"));
|
||||
|
|
|
@ -61,7 +61,7 @@ public class KeycloakApplication extends Application {
|
|||
classes.add(QRCodeResource.class);
|
||||
classes.add(ThemeResource.class);
|
||||
|
||||
setupDefaultRealm();
|
||||
setupDefaultRealm(context.getContextPath());
|
||||
}
|
||||
|
||||
public String getContextPath() {
|
||||
|
@ -78,8 +78,8 @@ public class KeycloakApplication extends Application {
|
|||
return uriInfo.getBaseUriBuilder().replacePath(getContextPath()).build();
|
||||
}
|
||||
|
||||
protected void setupDefaultRealm() {
|
||||
new ApplianceBootstrap().bootstrap(factory);
|
||||
protected void setupDefaultRealm(String contextPath) {
|
||||
new ApplianceBootstrap().bootstrap(factory, contextPath);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -244,7 +244,7 @@ public class AdminService {
|
|||
}
|
||||
|
||||
public static UriBuilder saasCookiePath(UriInfo uriInfo) {
|
||||
return contextRoot(uriInfo).path("rest").path(AdminService.class);
|
||||
return UriBuilder.fromUri(uriInfo.getBaseUri()).path(AdminService.class);
|
||||
}
|
||||
|
||||
@Path("realms")
|
||||
|
@ -366,7 +366,7 @@ public class AdminService {
|
|||
logger.debug("loginRedirect SUCCESS");
|
||||
NewCookie cookie = authManager.createCookie(adminRealm, adminConsole, code, AdminService.saasCookiePath(uriInfo).build());
|
||||
|
||||
URI redirectUri = contextRoot(uriInfo).path(adminPath).build();
|
||||
URI redirectUri = UriBuilder.fromUri(uriInfo.getBaseUri()).path("../").path(adminPath).build();
|
||||
if (path != null) {
|
||||
redirectUri = redirectUri.resolve("#" + UriBuilder.fromPath(path).build().toString());
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue