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