Merge pull request #156 from patriot1burke/master

use app name instead of id
This commit is contained in:
Bill Burke 2014-01-15 13:57:38 -08:00
commit bb38562f4f
22 changed files with 168 additions and 130 deletions

View file

@ -54,7 +54,7 @@ module.controller('ApplicationCredentialsCtrl', function($scope, $location, real
} }
]; ];
ApplicationCredentials.update({ realm : realm.realm, application : application.id }, creds, ApplicationCredentials.update({ realm : realm.realm, application : application.name }, creds,
function() { function() {
Notifications.success('The password has been changed.'); Notifications.success('The password has been changed.');
$scope.password = null; $scope.password = null;
@ -76,7 +76,7 @@ module.controller('ApplicationCredentialsCtrl', function($scope, $location, real
} }
]; ];
ApplicationCredentials.update({ realm : realm.realm, application : application.id }, creds, ApplicationCredentials.update({ realm : realm.realm, application : application.name }, creds,
function() { function() {
Notifications.success('The totp was changed.'); Notifications.success('The totp was changed.');
$scope.totp = null; $scope.totp = null;
@ -123,20 +123,20 @@ module.controller('ApplicationRoleDetailCtrl', function($scope, realm, applicati
if ($scope.create) { if ($scope.create) {
ApplicationRole.save({ ApplicationRole.save({
realm: realm.realm, realm: realm.realm,
application : application.id application : application.name
}, $scope.role, function (data, headers) { }, $scope.role, function (data, headers) {
$scope.changed = false; $scope.changed = false;
role = angular.copy($scope.role); role = angular.copy($scope.role);
var l = headers().location; var l = headers().location;
var id = l.substring(l.lastIndexOf("/") + 1); var id = l.substring(l.lastIndexOf("/") + 1);
$location.url("/realms/" + realm.realm + "/applications/" + application.id + "/roles/" + id); $location.url("/realms/" + realm.realm + "/applications/" + application.name + "/roles/" + id);
Notifications.success("The role has been created."); Notifications.success("The role has been created.");
}); });
} else { } else {
ApplicationRole.update({ ApplicationRole.update({
realm : realm.realm, realm : realm.realm,
application : application.id, application : application.name,
roleId : role.id roleId : role.id
}, $scope.role, function() { }, $scope.role, function() {
$scope.changed = false; $scope.changed = false;
@ -152,17 +152,17 @@ module.controller('ApplicationRoleDetailCtrl', function($scope, realm, applicati
}; };
$scope.cancel = function() { $scope.cancel = function() {
$location.url("/realms/" + realm.realm + "/applications/" + application.id + "/roles"); $location.url("/realms/" + realm.realm + "/applications/" + application.name + "/roles");
}; };
$scope.remove = function() { $scope.remove = function() {
Dialog.confirmDelete($scope.role.name, 'role', function() { Dialog.confirmDelete($scope.role.name, 'role', function() {
$scope.role.$remove({ $scope.role.$remove({
realm : realm.realm, realm : realm.realm,
application : application.id, application : application.name,
roleId : $scope.role.id roleId : $scope.role.id
}, function() { }, function() {
$location.url("/realms/" + realm.realm + "/applications/" + application.id + "/roles"); $location.url("/realms/" + realm.realm + "/applications/" + application.name + "/roles");
Notifications.success("The role has been deleted."); Notifications.success("The role has been deleted.");
}); });
}); });
@ -192,7 +192,7 @@ module.controller('ApplicationDetailCtrl', function($scope, realm, application,
console.log('ApplicationDetailCtrl'); console.log('ApplicationDetailCtrl');
$scope.realm = realm; $scope.realm = realm;
$scope.create = !application.id; $scope.create = !application.name;
if (!$scope.create) { if (!$scope.create) {
$scope.application= angular.copy(application); $scope.application= angular.copy(application);
} else { } else {
@ -233,7 +233,8 @@ module.controller('ApplicationDetailCtrl', function($scope, realm, application,
$scope.save = function() { $scope.save = function() {
if ($scope.create) { if ($scope.create) {
Application.save({ Application.save({
realm: realm.realm realm: realm.realm,
application: ''
}, $scope.application, function (data, headers) { }, $scope.application, function (data, headers) {
$scope.changed = false; $scope.changed = false;
var l = headers().location; var l = headers().location;
@ -244,7 +245,7 @@ module.controller('ApplicationDetailCtrl', function($scope, realm, application,
} else { } else {
Application.update({ Application.update({
realm : realm.realm, realm : realm.realm,
id : application.id id : application.name
}, $scope.application, function() { }, $scope.application, function() {
$scope.changed = false; $scope.changed = false;
application = angular.copy($scope.application); application = angular.copy($scope.application);
@ -266,7 +267,7 @@ module.controller('ApplicationDetailCtrl', function($scope, realm, application,
Dialog.confirmDelete($scope.application.name, 'application', function() { Dialog.confirmDelete($scope.application.name, 'application', function() {
$scope.application.$remove({ $scope.application.$remove({
realm : realm.realm, realm : realm.realm,
id : $scope.application.id id : $scope.application.name
}, function() { }, function() {
$location.url("/realms/" + realm.realm + "/applications"); $location.url("/realms/" + realm.realm + "/applications");
Notifications.success("The application has been deleted."); Notifications.success("The application has been deleted.");
@ -292,7 +293,7 @@ module.controller('ApplicationScopeMappingCtrl', function($scope, $http, realm,
$scope.realmMappings = ApplicationRealmScopeMapping.query({realm : realm.realm, application : application.id}, function(){ $scope.realmMappings = ApplicationRealmScopeMapping.query({realm : realm.realm, application : application.name}, function(){
for (var i = 0; i < $scope.realmMappings.length; i++) { for (var i = 0; i < $scope.realmMappings.length; i++) {
var role = $scope.realmMappings[i]; var role = $scope.realmMappings[i];
for (var j = 0; j < $scope.realmRoles.length; j++) { for (var j = 0; j < $scope.realmRoles.length; j++) {
@ -309,7 +310,7 @@ module.controller('ApplicationScopeMappingCtrl', function($scope, $http, realm,
}); });
$scope.addRealmRole = function() { $scope.addRealmRole = function() {
$http.post('/auth/rest/admin/realms/' + realm.realm + '/applications/' + application.id + '/scope-mappings/realm', $http.post('/auth/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];
@ -324,7 +325,7 @@ module.controller('ApplicationScopeMappingCtrl', function($scope, $http, realm,
}; };
$scope.deleteRealmRole = function() { $scope.deleteRealmRole = function() {
$http.delete('/auth/rest/admin/realms/' + realm.realm + '/applications/' + application.id + '/scope-mappings/realm', $http.delete('/auth/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];
@ -339,7 +340,7 @@ module.controller('ApplicationScopeMappingCtrl', function($scope, $http, realm,
}; };
$scope.addApplicationRole = function() { $scope.addApplicationRole = function() {
$http.post('/auth/rest/admin/realms/' + realm.realm + '/applications/' + application.id + '/scope-mappings/applications/' + $scope.targetApp.id, $http.post('/auth/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];
@ -354,7 +355,7 @@ module.controller('ApplicationScopeMappingCtrl', function($scope, $http, realm,
}; };
$scope.deleteApplicationRole = function() { $scope.deleteApplicationRole = function() {
$http.delete('/auth/rest/admin/realms/' + realm.realm + '/applications/' + application.id + '/scope-mappings/applications/' + $scope.targetApp.id, $http.delete('/auth/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];
@ -370,8 +371,8 @@ module.controller('ApplicationScopeMappingCtrl', function($scope, $http, realm,
$scope.changeApplication = function() { $scope.changeApplication = function() {
$scope.applicationRoles = ApplicationRole.query({realm : realm.realm, application : $scope.targetApp.id}, function() { $scope.applicationRoles = ApplicationRole.query({realm : realm.realm, application : $scope.targetApp.name}, function() {
$scope.applicationMappings = ApplicationApplicationScopeMapping.query({realm : realm.realm, application : application.id, targetApp : $scope.targetApp.id}, function(){ $scope.applicationMappings = ApplicationApplicationScopeMapping.query({realm : realm.realm, application : application.name, targetApp : $scope.targetApp.name}, function(){
for (var i = 0; i < $scope.applicationMappings.length; i++) { for (var i = 0; i < $scope.applicationMappings.length; i++) {
var role = $scope.applicationMappings[i]; var role = $scope.applicationMappings[i];
for (var j = 0; j < $scope.applicationRoles.length; j++) { for (var j = 0; j < $scope.applicationRoles.length; j++) {

View file

@ -239,7 +239,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.id, $http.post('/auth/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];
@ -254,7 +254,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.id, $http.delete('/auth/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];
@ -270,8 +270,8 @@ module.controller('OAuthClientScopeMappingCtrl', function($scope, $http, realm,
$scope.changeApplication = function() { $scope.changeApplication = function() {
$scope.applicationRoles = ApplicationRole.query({realm : realm.realm, application : $scope.targetApp.id}, function() { $scope.applicationRoles = ApplicationRole.query({realm : realm.realm, application : $scope.targetApp.name}, function() {
$scope.applicationMappings = OAuthClientApplicationScopeMapping.query({realm : realm.realm, oauth : oauth.id, targetApp : $scope.targetApp.id}, function(){ $scope.applicationMappings = OAuthClientApplicationScopeMapping.query({realm : realm.realm, oauth : oauth.id, targetApp : $scope.targetApp.name}, function(){
for (var i = 0; i < $scope.applicationMappings.length; i++) { for (var i = 0; i < $scope.applicationMappings.length; i++) {
var role = $scope.applicationMappings[i]; var role = $scope.applicationMappings[i];
for (var j = 0; j < $scope.applicationRoles.length; j++) { for (var j = 0; j < $scope.applicationRoles.length; j++) {

View file

@ -28,7 +28,7 @@ module.controller('HomeCtrl', function(Realm, $location) {
} else if (realms.length == 2) { } else if (realms.length == 2) {
if (realms[0].realm == 'keycloak-admin') { if (realms[0].realm == 'keycloak-admin') {
realm = realms[1].realm; realm = realms[1].realm;
} else if (realms[1].realm == 'keycloak-admin') { } else if (realms[1].realm == 'administration') {
realm = realms[0].realm; realm = realms[0].realm;
} }
} }
@ -502,7 +502,7 @@ module.controller('RealmRegistrationCtrl', function ($scope, Realm, realm, appli
$scope.selectedAppDefRoles = []; $scope.selectedAppDefRoles = [];
// Populate available roles for selected application // Populate available roles for selected application
var appDefaultRoles = ApplicationRole.query({realm: $scope.realm.realm, application: $scope.application.id}, function () { var appDefaultRoles = ApplicationRole.query({realm: $scope.realm.realm, application: $scope.application.name}, function () {
if (!$scope.application.hasOwnProperty('defaultRoles') || $scope.application.defaultRoles === null) { if (!$scope.application.hasOwnProperty('defaultRoles') || $scope.application.defaultRoles === null) {
$scope.application.defaultRoles = []; $scope.application.defaultRoles = [];
@ -540,7 +540,7 @@ module.controller('RealmRegistrationCtrl', function ($scope, Realm, realm, appli
// Update/save the selected application with new default roles. // Update/save the selected application with new default roles.
Application.update({ Application.update({
realm: $scope.realm.realm, realm: $scope.realm.realm,
id: $scope.application.id id: $scope.application.name
}, $scope.application, function () { }, $scope.application, function () {
Notifications.success("Your changes have been saved to the application."); Notifications.success("Your changes have been saved to the application.");
}); });
@ -564,7 +564,7 @@ module.controller('RealmRegistrationCtrl', function ($scope, Realm, realm, appli
// Update/save the selected application with new default roles. // Update/save the selected application with new default roles.
Application.update({ Application.update({
realm: $scope.realm.realm, realm: $scope.realm.realm,
id: $scope.application.id id: $scope.application.name
}, $scope.application, function () { }, $scope.application, function () {
Notifications.success("Your changes have been saved to the application."); Notifications.success("Your changes have been saved to the application.");
}); });

View file

@ -60,7 +60,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.id, $http.post('/auth/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];
@ -75,7 +75,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.id, $http.delete('/auth/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];
@ -91,8 +91,8 @@ module.controller('UserRoleMappingCtrl', function($scope, $http, realm, user, ro
$scope.changeApplication = function() { $scope.changeApplication = function() {
$scope.applicationRoles = ApplicationRole.query({realm : realm.realm, userId : user.username, application : $scope.application.id}, function() { $scope.applicationRoles = ApplicationRole.query({realm : realm.realm, userId : user.username, application : $scope.application.name}, function() {
$scope.applicationMappings = ApplicationRoleMapping.query({realm : realm.realm, userId : user.username, application : $scope.application.id}, function(){ $scope.applicationMappings = ApplicationRoleMapping.query({realm : realm.realm, userId : user.username, application : $scope.application.name}, function(){
for (var i = 0; i < $scope.applicationMappings.length; i++) { for (var i = 0; i < $scope.applicationMappings.length; i++) {
var role = $scope.applicationMappings[i]; var role = $scope.applicationMappings[i];
for (var j = 0; j < $scope.applicationRoles.length; j++) { for (var j = 0; j < $scope.applicationRoles.length; j++) {

View file

@ -111,7 +111,7 @@ module.factory('ApplicationLoader', function(Loader, Application, $route, $q) {
return Loader.get(Application, function() { return Loader.get(Application, function() {
return { return {
realm : $route.current.params.realm, realm : $route.current.params.realm,
id : $route.current.params.application application : $route.current.params.application
} }
}); });
}); });

View file

@ -208,9 +208,9 @@ module.factory('ApplicationRole', function($resource) {
module.factory('Application', function($resource) { module.factory('Application', function($resource) {
return $resource('/auth/rest/admin/realms/:realm/applications/:id', { return $resource('/auth/rest/admin/realms/:realm/applications/:application', {
realm : '@realm', realm : '@realm',
id : '@id' application : '@name'
}, { }, {
update : { update : {
method : 'PUT' method : 'PUT'

View file

@ -4,19 +4,19 @@
<div id="content-area" class="col-md-9" role="main"> <div id="content-area" class="col-md-9" role="main">
<div class="top-nav"> <div class="top-nav">
<ul class="rcue-tabs"> <ul class="rcue-tabs">
<li><a href="#/realms/{{realm.realm}}/applications/{{application.id}}">Settings</a></li> <li><a href="#/realms/{{realm.realm}}/applications/{{application.name}}">Settings</a></li>
<li class="active"><a href="#/realms/{{realm.realm}}/applications/{{application.id}}/credentials">Credentials</a></li> <li class="active"><a href="#/realms/{{realm.realm}}/applications/{{application.name}}/credentials">Credentials</a></li>
<li><a href="#/realms/{{realm.realm}}/applications/{{application.id}}/installation">Installation</a></li> <li><a href="#/realms/{{realm.realm}}/applications/{{application.name}}/installation">Installation</a></li>
<li><a href="#/realms/{{realm.realm}}/applications/{{application.id}}/roles">Roles</a></li> <li><a href="#/realms/{{realm.realm}}/applications/{{application.name}}/roles">Roles</a></li>
<li><a href="#/realms/{{realm.realm}}/applications/{{application.id}}/scope-mappings">Scope</a></li> <li><a href="#/realms/{{realm.realm}}/applications/{{application.name}}/scope-mappings">Scope</a></li>
<li><a href="#/realms/{{realm.realm}}/applications/{{application.id}}/sessions">Sessions</a></li> <li><a href="#/realms/{{realm.realm}}/applications/{{application.name}}/sessions">Sessions</a></li>
</ul> </ul>
</div> </div>
<div id="content"> <div id="content">
<ol class="breadcrumb" data-ng-hide="create"> <ol class="breadcrumb" data-ng-hide="create">
<li><a href="#/realms/{{realm.realm}}">{{realm.realm}}</a></li> <li><a href="#/realms/{{realm.realm}}">{{realm.realm}}</a></li>
<li><a href="#/realms/{{realm.realm}}/applications">Applications</a></li> <li><a href="#/realms/{{realm.realm}}/applications">Applications</a></li>
<li><a href="#/realms/{{realm.realm}}/applications/{{application.id}}">{{application.name}}</a></li> <li><a href="#/realms/{{realm.realm}}/applications/{{application.name}}">{{application.name}}</a></li>
<li class="active">Credentials</li> <li class="active">Credentials</li>
</ol> </ol>
<h2 data-ng-hide="create"><span>{{application.name}}</span> Credentials</h2> <h2 data-ng-hide="create"><span>{{application.name}}</span> Credentials</h2>

View file

@ -4,12 +4,12 @@
<div id="content-area" class="col-md-9" role="main"> <div id="content-area" class="col-md-9" role="main">
<div class="top-nav" data-ng-show="!create"> <div class="top-nav" data-ng-show="!create">
<ul class="rcue-tabs"> <ul class="rcue-tabs">
<li class="active"><a href="#/realms/{{realm.realm}}/applications/{{application.id}}">Settings</a></li> <li class="active"><a href="#/realms/{{realm.realm}}/applications/{{application.name}}">Settings</a></li>
<li><a href="#/realms/{{realm.realm}}/applications/{{application.id}}/credentials">Credentials</a></li> <li><a href="#/realms/{{realm.realm}}/applications/{{application.name}}/credentials">Credentials</a></li>
<li><a href="#/realms/{{realm.realm}}/applications/{{application.id}}/installation">Installation</a></li> <li><a href="#/realms/{{realm.realm}}/applications/{{application.name}}/installation">Installation</a></li>
<li><a href="#/realms/{{realm.realm}}/applications/{{application.id}}/roles">Roles</a></li> <li><a href="#/realms/{{realm.realm}}/applications/{{application.name}}/roles">Roles</a></li>
<li><a href="#/realms/{{realm.realm}}/applications/{{application.id}}/scope-mappings">Scope</a></li> <li><a href="#/realms/{{realm.realm}}/applications/{{application.name}}/scope-mappings">Scope</a></li>
<li><a href="#/realms/{{realm.realm}}/applications/{{application.id}}/sessions">Sessions</a></li> <li><a href="#/realms/{{realm.realm}}/applications/{{application.name}}/sessions">Sessions</a></li>
</ul> </ul>
</div> </div>
<div class="top-nav" data-ng-show="create"> <div class="top-nav" data-ng-show="create">
@ -28,7 +28,7 @@
<ol class="breadcrumb" data-ng-hide="create"> <ol class="breadcrumb" data-ng-hide="create">
<li><a href="#/realms/{{realm.realm}}">{{realm.realm}}</a></li> <li><a href="#/realms/{{realm.realm}}">{{realm.realm}}</a></li>
<li><a href="#/realms/{{realm.realm}}/applications">Applications</a></li> <li><a href="#/realms/{{realm.realm}}/applications">Applications</a></li>
<li><a href="#/realms/{{realm.realm}}/applications/{{application.id}}">{{application.name}}</a></li> <li><a href="#/realms/{{realm.realm}}/applications/{{application.name}}">{{application.name}}</a></li>
<li class="active">Settings</li> <li class="active">Settings</li>
</ol> </ol>
<h2 data-ng-hide="create"><span>{{application.name}}</span> Settings</h2> <h2 data-ng-hide="create"><span>{{application.name}}</span> Settings</h2>

View file

@ -4,12 +4,12 @@
<div id="content-area" class="col-md-9" role="main"> <div id="content-area" class="col-md-9" role="main">
<div class="top-nav" data-ng-show="!create"> <div class="top-nav" data-ng-show="!create">
<ul class="rcue-tabs"> <ul class="rcue-tabs">
<li><a href="#/realms/{{realm.realm}}/applications/{{application.id}}">Settings</a></li> <li><a href="#/realms/{{realm.realm}}/applications/{{application.name}}">Settings</a></li>
<li><a href="#/realms/{{realm.realm}}/applications/{{application.id}}/credentials">Credentials</a></li> <li><a href="#/realms/{{realm.realm}}/applications/{{application.name}}/credentials">Credentials</a></li>
<li class="active"><a href="#/realms/{{realm.realm}}/applications/{{application.id}}/installation">Installation</a></li> <li class="active"><a href="#/realms/{{realm.realm}}/applications/{{application.name}}/installation">Installation</a></li>
<li><a href="#/realms/{{realm.realm}}/applications/{{application.id}}/roles">Roles</a></li> <li><a href="#/realms/{{realm.realm}}/applications/{{application.name}}/roles">Roles</a></li>
<li><a href="#/realms/{{realm.realm}}/applications/{{application.id}}/scope-mappings">Scope</a></li> <li><a href="#/realms/{{realm.realm}}/applications/{{application.name}}/scope-mappings">Scope</a></li>
<li><a href="#/realms/{{realm.realm}}/applications/{{application.id}}/sessions">Sessions</a></li> <li><a href="#/realms/{{realm.realm}}/applications/{{application.name}}/sessions">Sessions</a></li>
</ul> </ul>
</div> </div>
<div class="top-nav" data-ng-show="create"> <div class="top-nav" data-ng-show="create">

View file

@ -53,7 +53,7 @@
</tfoot> </tfoot>
<tbody> <tbody>
<tr ng-repeat="app in applications | filter:search"> <tr ng-repeat="app in applications | filter:search">
<td><a href="#/realms/{{realm.realm}}/applications/{{app.id}}">{{app.name}}</a></td> <td><a href="#/realms/{{realm.realm}}/applications/{{app.name}}">{{app.name}}</a></td>
<td>{{app.enabled}}</td> <td>{{app.enabled}}</td>
<td ng-class="{'text-muted': !app.baseUrl}">{{app.baseUrl || "Not defined"}}</td> <td ng-class="{'text-muted': !app.baseUrl}">{{app.baseUrl || "Not defined"}}</td>
</tr> </tr>

View file

@ -4,20 +4,20 @@
<div id="content-area" class="col-md-9" role="main"> <div id="content-area" class="col-md-9" role="main">
<div class="top-nav"> <div class="top-nav">
<ul class="rcue-tabs"> <ul class="rcue-tabs">
<li><a href="#/realms/{{realm.realm}}/applications/{{application.id}}">Settings</a></li> <li><a href="#/realms/{{realm.realm}}/applications/{{application.name}}">Settings</a></li>
<li><a href="#/realms/{{realm.realm}}/applications/{{application.id}}/credentials">Credentials</a></li> <li><a href="#/realms/{{realm.realm}}/applications/{{application.name}}/credentials">Credentials</a></li>
<li><a href="#/realms/{{realm.realm}}/applications/{{application.id}}/installation">Installation</a></li> <li><a href="#/realms/{{realm.realm}}/applications/{{application.name}}/installation">Installation</a></li>
<li class="active"><a href="#/realms/{{realm.realm}}/applications/{{application.id}}/roles">Roles</a></li> <li class="active"><a href="#/realms/{{realm.realm}}/applications/{{application.name}}/roles">Roles</a></li>
<li><a href="#/realms/{{realm.realm}}/applications/{{application.id}}/scope-mappings">Scope</a></li> <li><a href="#/realms/{{realm.realm}}/applications/{{application.name}}/scope-mappings">Scope</a></li>
<li><a href="#/realms/{{realm.realm}}/applications/{{application.id}}/sessions">Sessions</a></li> <li><a href="#/realms/{{realm.realm}}/applications/{{application.name}}/sessions">Sessions</a></li>
</ul> </ul>
</div> </div>
<div id="content"> <div id="content">
<ol class="breadcrumb" data-ng-show="create"> <ol class="breadcrumb" data-ng-show="create">
<li><a href="#/realms/{{realm.realm}}">{{realm.realm}}</a></li> <li><a href="#/realms/{{realm.realm}}">{{realm.realm}}</a></li>
<li><a href="#/realms/{{realm.realm}}/applications">Applications</a></li> <li><a href="#/realms/{{realm.realm}}/applications">Applications</a></li>
<li><a href="#/realms/{{realm.realm}}/applications/{{application.id}}">{{application.name}}</a></li> <li><a href="#/realms/{{realm.realm}}/applications/{{application.name}}">{{application.name}}</a></li>
<li><a href="#/realms/{{realm.realm}}/applications/{{application.id}}/roles">Roles</a></li> <li><a href="#/realms/{{realm.realm}}/applications/{{application.name}}/roles">Roles</a></li>
<li class="active">Add role</li> <li class="active">Add role</li>
</ol> </ol>
<h2 class="pull-left" data-ng-show="create"><span>{{application.name}}</span> Add Role</h2> <h2 class="pull-left" data-ng-show="create"><span>{{application.name}}</span> Add Role</h2>
@ -26,8 +26,8 @@
<ol class="breadcrumb" data-ng-hide="create"> <ol class="breadcrumb" data-ng-hide="create">
<li><a href="#/realms/{{realm.realm}}">{{realm.realm}}</a></li> <li><a href="#/realms/{{realm.realm}}">{{realm.realm}}</a></li>
<li><a href="#/realms/{{realm.realm}}/applications">Applications</a></li> <li><a href="#/realms/{{realm.realm}}/applications">Applications</a></li>
<li><a href="#/realms/{{realm.realm}}/applications/{{application.id}}">{{application.name}}</a></li> <li><a href="#/realms/{{realm.realm}}/applications/{{application.name}}">{{application.name}}</a></li>
<li><a href="#/realms/{{realm.realm}}/applications/{{application.id}}/roles">Roles</a></li> <li><a href="#/realms/{{realm.realm}}/applications/{{application.name}}/roles">Roles</a></li>
<li class="active">{{role.name}}</li> <li class="active">{{role.name}}</li>
</ol> </ol>

View file

@ -4,24 +4,24 @@
<div id="content-area" class="col-md-9" role="main"> <div id="content-area" class="col-md-9" role="main">
<div class="top-nav"> <div class="top-nav">
<ul class="rcue-tabs"> <ul class="rcue-tabs">
<li><a href="#/realms/{{realm.realm}}/applications/{{application.id}}">Settings</a></li> <li><a href="#/realms/{{realm.realm}}/applications/{{application.name}}">Settings</a></li>
<li><a href="#/realms/{{realm.realm}}/applications/{{application.id}}/credentials">Credentials</a></li> <li><a href="#/realms/{{realm.realm}}/applications/{{application.name}}/credentials">Credentials</a></li>
<li><a href="#/realms/{{realm.realm}}/applications/{{application.id}}/installation">Installation</a></li> <li><a href="#/realms/{{realm.realm}}/applications/{{application.name}}/installation">Installation</a></li>
<li class="active"><a href="#/realms/{{realm.realm}}/applications/{{application.id}}/roles">Roles</a></li> <li class="active"><a href="#/realms/{{realm.realm}}/applications/{{application.name}}/roles">Roles</a></li>
<li><a href="#/realms/{{realm.realm}}/applications/{{application.id}}/scope-mappings">Scope</a></li> <li><a href="#/realms/{{realm.realm}}/applications/{{application.name}}/scope-mappings">Scope</a></li>
<li><a href="#/realms/{{realm.realm}}/applications/{{application.id}}/sessions">Sessions</a></li> <li><a href="#/realms/{{realm.realm}}/applications/{{application.name}}/sessions">Sessions</a></li>
</ul> </ul>
</div> </div>
<div id="content"> <div id="content">
<ol class="breadcrumb" data-ng-hide="create"> <ol class="breadcrumb" data-ng-hide="create">
<li><a href="#/realms/{{realm.realm}}">{{realm.realm}}</a></li> <li><a href="#/realms/{{realm.realm}}">{{realm.realm}}</a></li>
<li><a href="#/realms/{{realm.realm}}/applications">Applications</a></li> <li><a href="#/realms/{{realm.realm}}/applications">Applications</a></li>
<li><a href="#/realms/{{realm.realm}}/applications/{{application.id}}">{{application.name}}</a></li> <li><a href="#/realms/{{realm.realm}}/applications/{{application.name}}">{{application.name}}</a></li>
<li class="active">Roles</li> <li class="active">Roles</li>
</ol> </ol>
<h2><span>{{application.name}}</span> Roles</h2> <h2><span>{{application.name}}</span> Roles</h2>
<div class="feedback info inline" data-ng-show="!roles || roles.length == 0"> <div class="feedback info inline" data-ng-show="!roles || roles.length == 0">
<p><strong>You have not configured application roles.</strong> <a class="button" href="#/create/role/{{realm.realm}}/applications/{{application.id}}">Add Role</a></p> <p><strong>You have not configured application roles.</strong> <a class="button" href="#/create/role/{{realm.realm}}/applications/{{application.name}}">Add Role</a></p>
</div> </div>
<table data-ng-hide="!roles || roles.length == 0"> <table data-ng-hide="!roles || roles.length == 0">
<caption data-ng-show="roles && roles.length > 0" class="hidden">Table of realm roles</caption> <caption data-ng-show="roles && roles.length > 0" class="hidden">Table of realm roles</caption>
@ -29,7 +29,7 @@
<tr> <tr>
<th class="rcue-table-actions" colspan="2"> <th class="rcue-table-actions" colspan="2">
<div class="actions"> <div class="actions">
<a class="button" href="#/create/role/{{realm.realm}}/applications/{{application.id}}">Add Role</a> <a class="button" href="#/create/role/{{realm.realm}}/applications/{{application.name}}">Add Role</a>
<!-- <button class="remove disabled">Remove</button> --> <!-- <button class="remove disabled">Remove</button> -->
</div> </div>
</th> </th>
@ -64,7 +64,7 @@
</tfoot> </tfoot>
<tbody> <tbody>
<tr ng-repeat="role in roles"> <tr ng-repeat="role in roles">
<td><a href="#/realms/{{realm.realm}}/applications/{{application.id}}/roles/{{role.id}}">{{role.name}}</a></td> <td><a href="#/realms/{{realm.realm}}/applications/{{application.name}}/roles/{{role.id}}">{{role.name}}</a></td>
<td>{{role.description}}</td> <td>{{role.description}}</td>
</tr> </tr>
</tbody> </tbody>

View file

@ -4,19 +4,19 @@
<div id="content-area" class="col-md-9" role="main"> <div id="content-area" class="col-md-9" role="main">
<div class="top-nav"> <div class="top-nav">
<ul class="rcue-tabs"> <ul class="rcue-tabs">
<li><a href="#/realms/{{realm.realm}}/applications/{{application.id}}">Settings</a></li> <li><a href="#/realms/{{realm.realm}}/applications/{{application.name}}">Settings</a></li>
<li><a href="#/realms/{{realm.realm}}/applications/{{application.id}}/credentials">Credentials</a></li> <li><a href="#/realms/{{realm.realm}}/applications/{{application.name}}/credentials">Credentials</a></li>
<li><a href="#">Installation</a></li> <li><a href="#">Installation</a></li>
<li><a href="#/realms/{{realm.realm}}/applications/{{application.id}}/roles">Roles</a></li> <li><a href="#/realms/{{realm.realm}}/applications/{{application.name}}/roles">Roles</a></li>
<li class="active"><a href="#/realms/{{realm.realm}}/applications/{{application.id}}/scope-mappings">Scope</a></li> <li class="active"><a href="#/realms/{{realm.realm}}/applications/{{application.name}}/scope-mappings">Scope</a></li>
<li><a href="#/realms/{{realm.realm}}/applications/{{application.id}}/sessions">Sessions</a></li> <li><a href="#/realms/{{realm.realm}}/applications/{{application.name}}/sessions">Sessions</a></li>
</ul> </ul>
</div> </div>
<div id="content"> <div id="content">
<ol class="breadcrumb" data-ng-hide="create"> <ol class="breadcrumb" data-ng-hide="create">
<li><a href="#/realms/{{realm.realm}}">{{realm.realm}}</a></li> <li><a href="#/realms/{{realm.realm}}">{{realm.realm}}</a></li>
<li><a href="#/realms/{{realm.realm}}/applications">Applications</a></li> <li><a href="#/realms/{{realm.realm}}/applications">Applications</a></li>
<li><a href="#/realms/{{realm.realm}}/applications/{{application.id}}">{{application.name}}</a></li> <li><a href="#/realms/{{realm.realm}}/applications/{{application.name}}">{{application.name}}</a></li>
<li class="active">Scope</li> <li class="active">Scope</li>
</ol> </ol>
<h2 class="pull-left"><span>{{application.name}}</span> Scope Mappings</h2> <h2 class="pull-left"><span>{{application.name}}</span> Scope Mappings</h2>

View file

@ -4,19 +4,19 @@
<div id="content-area" class="col-md-9" role="main"> <div id="content-area" class="col-md-9" role="main">
<div class="top-nav"> <div class="top-nav">
<ul class="rcue-tabs"> <ul class="rcue-tabs">
<li><a href="#/realms/{{realm.realm}}/applications/{{application.id}}">Settings</a></li> <li><a href="#/realms/{{realm.realm}}/applications/{{application.name}}">Settings</a></li>
<li><a href="#/realms/{{realm.realm}}/applications/{{application.id}}/credentials">Credentials</a></li> <li><a href="#/realms/{{realm.realm}}/applications/{{application.name}}/credentials">Credentials</a></li>
<li><a href="#/realms/{{realm.realm}}/applications/{{application.id}}/installation">Installation</a></li> <li><a href="#/realms/{{realm.realm}}/applications/{{application.name}}/installation">Installation</a></li>
<li><a href="#/realms/{{realm.realm}}/applications/{{application.id}}/roles">Roles</a></li> <li><a href="#/realms/{{realm.realm}}/applications/{{application.name}}/roles">Roles</a></li>
<li><a href="#/realms/{{realm.realm}}/applications/{{application.id}}/scope-mappings">Scope</a></li> <li><a href="#/realms/{{realm.realm}}/applications/{{application.name}}/scope-mappings">Scope</a></li>
<li class="active"><a href="#/realms/{{realm.realm}}/applications/{{application.id}}/sessions">Sessions</a></li> <li class="active"><a href="#/realms/{{realm.realm}}/applications/{{application.name}}/sessions">Sessions</a></li>
</ul> </ul>
</div> </div>
<div id="content"> <div id="content">
<ol class="breadcrumb" data-ng-hide="create"> <ol class="breadcrumb" data-ng-hide="create">
<li><a href="#/realms/{{realm.realm}}">{{realm.realm}}</a></li> <li><a href="#/realms/{{realm.realm}}">{{realm.realm}}</a></li>
<li><a href="#/realms/{{realm.realm}}/applications">Applications</a></li> <li><a href="#/realms/{{realm.realm}}/applications">Applications</a></li>
<li><a href="#/realms/{{realm.realm}}/applications/{{application.id}}">{{application.name}}</a></li> <li><a href="#/realms/{{realm.realm}}/applications/{{application.name}}">{{application.name}}</a></li>
<li class="active">Sessions</li> <li class="active">Sessions</li>
</ol> </ol>
<h2 data-ng-hide="create"><span>{{application.name}}</span> Sessions (Placeholder Page)</h2> <h2 data-ng-hide="create"><span>{{application.name}}</span> Sessions (Placeholder Page)</h2>

View file

@ -9,8 +9,7 @@
"realm" : "demo", "realm" : "demo",
"resource" : "customer-portal", "resource" : "customer-portal",
"realm-public-key" : "MIGfMA0GCSqGSIb3D...31LwIDAQAB", "realm-public-key" : "MIGfMA0GCSqGSIb3D...31LwIDAQAB",
"auth-url" : "https://localhost:8443/.../realms/demo/tokens/login", "auth-server-url" : "https://localhost:8443/auth",
"code-url" : "https://localhost:8443/.../realms/demo/tokens/access/codes",
"ssl-not-required" : false, "ssl-not-required" : false,
"user-resource-role-mappings" : false, "user-resource-role-mappings" : false,
"enable-cors" : true, "enable-cors" : true,
@ -22,9 +21,9 @@
"password" : "password" "password" : "password"
} }
"connection-pool-size" : 5, "connection-pool-size" : 20,
"allo-any-hostname" : false,
"disable-trust-manager" false, "disable-trust-manager" false,
"allow-any-hostname" : false,
"truststore" : "path/to/truststore.jks", "truststore" : "path/to/truststore.jks",
"truststore-password" : "geheim", "truststore-password" : "geheim",
"client-keystore" : "path/to/client-keystore.jks", "client-keystore" : "path/to/client-keystore.jks",
@ -79,22 +78,11 @@
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term>auth-url</term> <term>auth-server-url</term>
<listitem> <listitem>
<para> <para>
URL of the realm's login page of the Keycloak Server's token service. You can obtain The base URL of the Keycloak Server. All other Keycloak pages and REST services are derived
this URL from the admin console. from this. It is usually of the form <literal>https://host:port/auth</literal>
This is
<emphasis>REQUIRED.</emphasis>
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>code-url</term>
<listitem>
<para>
URL to turn an access code into an access token. You can obtain
this URL from the admin console.
This is This is
<emphasis>REQUIRED.</emphasis> <emphasis>REQUIRED.</emphasis>
</para> </para>
@ -191,6 +179,41 @@
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry>
<term>connection-pool-size</term>
<listitem>
<para>
Adapters will make separate HTTP invocations to the Keycloak Server to turn an access code
into an access token. This config option defines how many connections to the Keycloak Server
should be pooled.
This is<emphasis>OPTIONAL</emphasis>. The default value is <literal>20</literal>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>disable-trust-manager</term>
<listitem>
<para>
If the Keycloak Server requires HTTPS and this config option is set to <literal>true</literal>
you do not have to specify a truststore. While convenient, this setting is not recommended
as you will not be verifying the host name of the Keycloak Server.
This is<emphasis>OPTIONAL</emphasis>. The default value is <literal>false</literal>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>allow-any-hostname</term>
<listitem>
<para>
If the Keycloak Server requires HTTPS and this config option is set to <literal>true</literal>
the Keycloak Server's certificate is validated via the truststore, but host name validation is
not done. This is not a recommended. This seting may be useful in test environments
This is<emphasis>OPTIONAL</emphasis>. The default value is <literal>false</literal>.
</para>
</listitem>
</varlistentry>
<varlistentry> <varlistentry>
<term>truststore</term> <term>truststore</term>
<listitem> <listitem>

View file

@ -112,6 +112,7 @@ public interface RealmModel extends RoleContainerModel, RoleMapperModel, ScopeMa
List<RequiredCredentialModel> getRequiredOAuthClientCredentials(); List<RequiredCredentialModel> getRequiredOAuthClientCredentials();
ApplicationModel getApplicationById(String id); ApplicationModel getApplicationById(String id);
ApplicationModel getApplicationByName(String name);
void addRequiredOAuthClientCredential(String type); void addRequiredOAuthClientCredential(String type);

View file

@ -604,6 +604,11 @@ public class RealmAdapter implements RealmModel {
return new ApplicationAdapter(em, app); return new ApplicationAdapter(em, app);
} }
@Override
public ApplicationModel getApplicationByName(String name) {
return getApplicationNameMap().get(name);
}
@Override @Override
public UserModel getUserBySocialLink(SocialLinkModel socialLink) { public UserModel getUserBySocialLink(SocialLinkModel socialLink) {
TypedQuery<UserEntity> query = em.createNamedQuery("findUserByLinkAndRealm", UserEntity.class); TypedQuery<UserEntity> query = em.createNamedQuery("findUserByLinkAndRealm", UserEntity.class);

View file

@ -26,7 +26,8 @@ import java.util.Map;
@NamedQueries({ @NamedQueries({
@NamedQuery(name="getAllRealms", query="select realm from RealmEntity realm"), @NamedQuery(name="getAllRealms", query="select realm from RealmEntity realm"),
@NamedQuery(name="getRealmByName", query="select realm from RealmEntity realm where realm.name = :name"), @NamedQuery(name="getRealmByName", query="select realm from RealmEntity realm where realm.name = :name"),
})public class RealmEntity { })
public class RealmEntity {
@Id @Id
protected String id; protected String id;

View file

@ -618,6 +618,12 @@ public class RealmAdapter implements RealmModel {
return model; return model;
} }
@Override
public ApplicationModel getApplicationByName(String name) {
return getApplicationNameMap().get(name);
}
@Override @Override
public List<ApplicationModel> getApplications() { public List<ApplicationModel> getApplications() {

View file

@ -64,12 +64,12 @@ public class ApplicationsResource {
} }
ApplicationManager resourceManager = new ApplicationManager(new RealmManager(session)); ApplicationManager resourceManager = new ApplicationManager(new RealmManager(session));
ApplicationModel applicationModel = resourceManager.createApplication(realm, rep); ApplicationModel applicationModel = resourceManager.createApplication(realm, rep);
return Response.created(uriInfo.getAbsolutePathBuilder().path(applicationModel.getId()).build()).build(); return Response.created(uriInfo.getAbsolutePathBuilder().path(applicationModel.getName()).build()).build();
} }
@Path("{id}") @Path("{app-name}")
public ApplicationResource getApplication(final @PathParam("id") String id) { public ApplicationResource getApplication(final @PathParam("app-name") String name) {
ApplicationModel applicationModel = realm.getApplicationById(id); ApplicationModel applicationModel = realm.getApplicationByName(name);
if (applicationModel == null) { if (applicationModel == null) {
throw new NotFoundException(); throw new NotFoundException();
} }

View file

@ -126,12 +126,12 @@ public class ScopeMappedResource {
} }
} }
@Path("applications/{appId}") @Path("applications/{app}")
@GET @GET
@Produces("application/json") @Produces("application/json")
@NoCache @NoCache
public List<RoleRepresentation> getApplicationScopeMappings(@PathParam("appId") String appId) { public List<RoleRepresentation> getApplicationScopeMappings(@PathParam("app") String appName) {
ApplicationModel app = realm.getApplicationById(appId); ApplicationModel app = realm.getApplicationByName(appName);
if (app == null) { if (app == null) {
throw new NotFoundException(); throw new NotFoundException();
@ -145,11 +145,11 @@ public class ScopeMappedResource {
return mapRep; return mapRep;
} }
@Path("applications/{appId}") @Path("applications/{app}")
@POST @POST
@Consumes("application/json") @Consumes("application/json")
public void addApplicationScopeMapping(@PathParam("appId") String appId, List<RoleRepresentation> roles) { public void addApplicationScopeMapping(@PathParam("app") String appName, List<RoleRepresentation> roles) {
ApplicationModel app = realm.getApplicationById(appId); ApplicationModel app = realm.getApplicationByName(appName);
if (app == null) { if (app == null) {
throw new NotFoundException(); throw new NotFoundException();
@ -165,11 +165,11 @@ public class ScopeMappedResource {
} }
@Path("applications/{appId}") @Path("applications/{app}")
@DELETE @DELETE
@Consumes("application/json") @Consumes("application/json")
public void deleteApplicationRoleMapping(@PathParam("appId") String appId, List<RoleRepresentation> roles) { public void deleteApplicationRoleMapping(@PathParam("app") String appName, List<RoleRepresentation> roles) {
ApplicationModel app = realm.getApplicationById(appId); ApplicationModel app = realm.getApplicationByName(appName);
if (app == null) { if (app == null) {
throw new NotFoundException(); throw new NotFoundException();
@ -190,4 +190,5 @@ public class ScopeMappedResource {
app.deleteScopeMapping(agent, roleModel); app.deleteScopeMapping(agent, roleModel);
} }
} }
}} }
}

View file

@ -282,11 +282,11 @@ public class UsersResource {
} }
} }
@Path("{username}/role-mappings/applications/{appId}") @Path("{username}/role-mappings/applications/{app}")
@GET @GET
@Produces("application/json") @Produces("application/json")
@NoCache @NoCache
public List<RoleRepresentation> getApplicationRoleMappings(@PathParam("username") String username, @PathParam("appId") String appId) { public List<RoleRepresentation> getApplicationRoleMappings(@PathParam("username") String username, @PathParam("app") String appName) {
logger.debug("getApplicationRoleMappings"); logger.debug("getApplicationRoleMappings");
UserModel user = realm.getUser(username); UserModel user = realm.getUser(username);
@ -294,7 +294,7 @@ public class UsersResource {
throw new NotFoundException(); throw new NotFoundException();
} }
ApplicationModel application = realm.getApplicationById(appId); ApplicationModel application = realm.getApplicationByName(appName);
if (application == null) { if (application == null) {
throw new NotFoundException(); throw new NotFoundException();
@ -309,17 +309,17 @@ public class UsersResource {
return mapRep; return mapRep;
} }
@Path("{username}/role-mappings/applications/{appId}") @Path("{username}/role-mappings/applications/{app}")
@POST @POST
@Consumes("application/json") @Consumes("application/json")
public void addApplicationRoleMapping(@PathParam("username") String username, @PathParam("appId") String appId, List<RoleRepresentation> roles) { public void addApplicationRoleMapping(@PathParam("username") String username, @PathParam("app") String appName, List<RoleRepresentation> roles) {
logger.debug("addApplicationRoleMapping"); logger.debug("addApplicationRoleMapping");
UserModel user = realm.getUser(username); UserModel user = realm.getUser(username);
if (user == null) { if (user == null) {
throw new NotFoundException(); throw new NotFoundException();
} }
ApplicationModel application = realm.getApplicationById(appId); ApplicationModel application = realm.getApplicationByName(appName);
if (application == null) { if (application == null) {
throw new NotFoundException(); throw new NotFoundException();
@ -335,16 +335,16 @@ public class UsersResource {
} }
@Path("{username}/role-mappings/applications/{appId}") @Path("{username}/role-mappings/applications/{app}")
@DELETE @DELETE
@Consumes("application/json") @Consumes("application/json")
public void deleteApplicationRoleMapping(@PathParam("username") String username, @PathParam("appId") String appId, List<RoleRepresentation> roles) { public void deleteApplicationRoleMapping(@PathParam("username") String username, @PathParam("app") String appName, List<RoleRepresentation> roles) {
UserModel user = realm.getUser(username); UserModel user = realm.getUser(username);
if (user == null) { if (user == null) {
throw new NotFoundException(); throw new NotFoundException();
} }
ApplicationModel application = realm.getApplicationById(appId); ApplicationModel application = realm.getApplicationByName(appName);
if (application == null) { if (application == null) {
throw new NotFoundException(); throw new NotFoundException();