use app name instead of id

This commit is contained in:
Bill Burke 2014-01-15 16:57:12 -05:00
parent 6326d5d2b5
commit ed0d33126c
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() {
Notifications.success('The password has been changed.');
$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() {
Notifications.success('The totp was changed.');
$scope.totp = null;
@ -123,20 +123,20 @@ module.controller('ApplicationRoleDetailCtrl', function($scope, realm, applicati
if ($scope.create) {
ApplicationRole.save({
realm: realm.realm,
application : application.id
application : application.name
}, $scope.role, function (data, headers) {
$scope.changed = false;
role = angular.copy($scope.role);
var l = headers().location;
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.");
});
} else {
ApplicationRole.update({
realm : realm.realm,
application : application.id,
application : application.name,
roleId : role.id
}, $scope.role, function() {
$scope.changed = false;
@ -152,17 +152,17 @@ module.controller('ApplicationRoleDetailCtrl', function($scope, realm, applicati
};
$scope.cancel = function() {
$location.url("/realms/" + realm.realm + "/applications/" + application.id + "/roles");
$location.url("/realms/" + realm.realm + "/applications/" + application.name + "/roles");
};
$scope.remove = function() {
Dialog.confirmDelete($scope.role.name, 'role', function() {
$scope.role.$remove({
realm : realm.realm,
application : application.id,
application : application.name,
roleId : $scope.role.id
}, 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.");
});
});
@ -192,7 +192,7 @@ module.controller('ApplicationDetailCtrl', function($scope, realm, application,
console.log('ApplicationDetailCtrl');
$scope.realm = realm;
$scope.create = !application.id;
$scope.create = !application.name;
if (!$scope.create) {
$scope.application= angular.copy(application);
} else {
@ -233,7 +233,8 @@ module.controller('ApplicationDetailCtrl', function($scope, realm, application,
$scope.save = function() {
if ($scope.create) {
Application.save({
realm: realm.realm
realm: realm.realm,
application: ''
}, $scope.application, function (data, headers) {
$scope.changed = false;
var l = headers().location;
@ -244,7 +245,7 @@ module.controller('ApplicationDetailCtrl', function($scope, realm, application,
} else {
Application.update({
realm : realm.realm,
id : application.id
id : application.name
}, $scope.application, function() {
$scope.changed = false;
application = angular.copy($scope.application);
@ -266,7 +267,7 @@ module.controller('ApplicationDetailCtrl', function($scope, realm, application,
Dialog.confirmDelete($scope.application.name, 'application', function() {
$scope.application.$remove({
realm : realm.realm,
id : $scope.application.id
id : $scope.application.name
}, function() {
$location.url("/realms/" + realm.realm + "/applications");
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++) {
var role = $scope.realmMappings[i];
for (var j = 0; j < $scope.realmRoles.length; j++) {
@ -309,7 +310,7 @@ module.controller('ApplicationScopeMappingCtrl', function($scope, $http, realm,
});
$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() {
for (var i = 0; i < $scope.selectedRealmRoles.length; i++) {
var role = $scope.selectedRealmRoles[i];
@ -324,7 +325,7 @@ module.controller('ApplicationScopeMappingCtrl', function($scope, $http, realm,
};
$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() {
for (var i = 0; i < $scope.selectedRealmMappings.length; i++) {
var role = $scope.selectedRealmMappings[i];
@ -339,7 +340,7 @@ module.controller('ApplicationScopeMappingCtrl', function($scope, $http, realm,
};
$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() {
for (var i = 0; i < $scope.selectedApplicationRoles.length; i++) {
var role = $scope.selectedApplicationRoles[i];
@ -354,7 +355,7 @@ module.controller('ApplicationScopeMappingCtrl', function($scope, $http, realm,
};
$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() {
for (var i = 0; i < $scope.selectedApplicationMappings.length; i++) {
var role = $scope.selectedApplicationMappings[i];
@ -370,8 +371,8 @@ module.controller('ApplicationScopeMappingCtrl', function($scope, $http, realm,
$scope.changeApplication = function() {
$scope.applicationRoles = ApplicationRole.query({realm : realm.realm, application : $scope.targetApp.id}, function() {
$scope.applicationMappings = ApplicationApplicationScopeMapping.query({realm : realm.realm, application : application.id, targetApp : $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.name, targetApp : $scope.targetApp.name}, function(){
for (var i = 0; i < $scope.applicationMappings.length; i++) {
var role = $scope.applicationMappings[i];
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() {
$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() {
for (var i = 0; i < $scope.selectedApplicationRoles.length; i++) {
var role = $scope.selectedApplicationRoles[i];
@ -254,7 +254,7 @@ module.controller('OAuthClientScopeMappingCtrl', function($scope, $http, realm,
};
$scope.deleteApplicationRole = function() {
$http.delete('/auth/rest/admin/realms/' + realm.realm + '/oauth-clients/' + oauth.id + '/scope-mappings/applications/' + $scope.targetApp.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() {
for (var i = 0; i < $scope.selectedApplicationMappings.length; i++) {
var role = $scope.selectedApplicationMappings[i];
@ -270,8 +270,8 @@ module.controller('OAuthClientScopeMappingCtrl', function($scope, $http, realm,
$scope.changeApplication = function() {
$scope.applicationRoles = ApplicationRole.query({realm : realm.realm, application : $scope.targetApp.id}, function() {
$scope.applicationMappings = OAuthClientApplicationScopeMapping.query({realm : realm.realm, oauth : oauth.id, targetApp : $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.name}, function(){
for (var i = 0; i < $scope.applicationMappings.length; i++) {
var role = $scope.applicationMappings[i];
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) {
if (realms[0].realm == 'keycloak-admin') {
realm = realms[1].realm;
} else if (realms[1].realm == 'keycloak-admin') {
} else if (realms[1].realm == 'administration') {
realm = realms[0].realm;
}
}
@ -502,7 +502,7 @@ module.controller('RealmRegistrationCtrl', function ($scope, Realm, realm, appli
$scope.selectedAppDefRoles = [];
// 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) {
$scope.application.defaultRoles = [];
@ -540,7 +540,7 @@ module.controller('RealmRegistrationCtrl', function ($scope, Realm, realm, appli
// Update/save the selected application with new default roles.
Application.update({
realm: $scope.realm.realm,
id: $scope.application.id
id: $scope.application.name
}, $scope.application, function () {
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.
Application.update({
realm: $scope.realm.realm,
id: $scope.application.id
id: $scope.application.name
}, $scope.application, function () {
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() {
$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() {
for (var i = 0; i < $scope.selectedApplicationRoles.length; i++) {
var role = $scope.selectedApplicationRoles[i];
@ -75,7 +75,7 @@ module.controller('UserRoleMappingCtrl', function($scope, $http, realm, user, ro
};
$scope.deleteApplicationRole = function() {
$http.delete('/auth/rest/admin/realms/' + realm.realm + '/users/' + user.username + '/role-mappings/applications/' + $scope.application.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() {
for (var i = 0; i < $scope.selectedApplicationMappings.length; i++) {
var role = $scope.selectedApplicationMappings[i];
@ -91,8 +91,8 @@ module.controller('UserRoleMappingCtrl', function($scope, $http, realm, user, ro
$scope.changeApplication = function() {
$scope.applicationRoles = ApplicationRole.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.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.name}, function(){
for (var i = 0; i < $scope.applicationMappings.length; i++) {
var role = $scope.applicationMappings[i];
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 {
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) {
return $resource('/auth/rest/admin/realms/:realm/applications/:id', {
return $resource('/auth/rest/admin/realms/:realm/applications/:application', {
realm : '@realm',
id : '@id'
application : '@name'
}, {
update : {
method : 'PUT'

View file

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

View file

@ -53,7 +53,7 @@
</tfoot>
<tbody>
<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 ng-class="{'text-muted': !app.baseUrl}">{{app.baseUrl || "Not defined"}}</td>
</tr>

View file

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

View file

@ -4,24 +4,24 @@
<div id="content-area" class="col-md-9" role="main">
<div class="top-nav">
<ul class="rcue-tabs">
<li><a href="#/realms/{{realm.realm}}/applications/{{application.id}}">Settings</a></li>
<li><a href="#/realms/{{realm.realm}}/applications/{{application.id}}/credentials">Credentials</a></li>
<li><a href="#/realms/{{realm.realm}}/applications/{{application.id}}/installation">Installation</a></li>
<li class="active"><a href="#/realms/{{realm.realm}}/applications/{{application.id}}/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.id}}/sessions">Sessions</a></li>
<li><a href="#/realms/{{realm.realm}}/applications/{{application.name}}">Settings</a></li>
<li><a href="#/realms/{{realm.realm}}/applications/{{application.name}}/credentials">Credentials</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.name}}/roles">Roles</a></li>
<li><a href="#/realms/{{realm.realm}}/applications/{{application.name}}/scope-mappings">Scope</a></li>
<li><a href="#/realms/{{realm.realm}}/applications/{{application.name}}/sessions">Sessions</a></li>
</ul>
</div>
<div id="content">
<ol class="breadcrumb" data-ng-hide="create">
<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/{{application.id}}">{{application.name}}</a></li>
<li><a href="#/realms/{{realm.realm}}/applications/{{application.name}}">{{application.name}}</a></li>
<li class="active">Roles</li>
</ol>
<h2><span>{{application.name}}</span> Roles</h2>
<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>
<table data-ng-hide="!roles || roles.length == 0">
<caption data-ng-show="roles && roles.length > 0" class="hidden">Table of realm roles</caption>
@ -29,7 +29,7 @@
<tr>
<th class="rcue-table-actions" colspan="2">
<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> -->
</div>
</th>
@ -64,7 +64,7 @@
</tfoot>
<tbody>
<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>
</tr>
</tbody>

View file

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

View file

@ -9,8 +9,7 @@
"realm" : "demo",
"resource" : "customer-portal",
"realm-public-key" : "MIGfMA0GCSqGSIb3D...31LwIDAQAB",
"auth-url" : "https://localhost:8443/.../realms/demo/tokens/login",
"code-url" : "https://localhost:8443/.../realms/demo/tokens/access/codes",
"auth-server-url" : "https://localhost:8443/auth",
"ssl-not-required" : false,
"user-resource-role-mappings" : false,
"enable-cors" : true,
@ -22,9 +21,9 @@
"password" : "password"
}
"connection-pool-size" : 5,
"allo-any-hostname" : false,
"connection-pool-size" : 20,
"disable-trust-manager" false,
"allow-any-hostname" : false,
"truststore" : "path/to/truststore.jks",
"truststore-password" : "geheim",
"client-keystore" : "path/to/client-keystore.jks",
@ -79,22 +78,11 @@
</listitem>
</varlistentry>
<varlistentry>
<term>auth-url</term>
<term>auth-server-url</term>
<listitem>
<para>
URL of the realm's login page of the Keycloak Server's token service. You can obtain
this URL from the admin console.
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.
The base URL of the Keycloak Server. All other Keycloak pages and REST services are derived
from this. It is usually of the form <literal>https://host:port/auth</literal>
This is
<emphasis>REQUIRED.</emphasis>
</para>
@ -191,6 +179,41 @@
</para>
</listitem>
</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>
<term>truststore</term>
<listitem>

View file

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

View file

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

View file

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

View file

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

View file

@ -64,12 +64,12 @@ public class ApplicationsResource {
}
ApplicationManager resourceManager = new ApplicationManager(new RealmManager(session));
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}")
public ApplicationResource getApplication(final @PathParam("id") String id) {
ApplicationModel applicationModel = realm.getApplicationById(id);
@Path("{app-name}")
public ApplicationResource getApplication(final @PathParam("app-name") String name) {
ApplicationModel applicationModel = realm.getApplicationByName(name);
if (applicationModel == null) {
throw new NotFoundException();
}

View file

@ -126,12 +126,12 @@ public class ScopeMappedResource {
}
}
@Path("applications/{appId}")
@Path("applications/{app}")
@GET
@Produces("application/json")
@NoCache
public List<RoleRepresentation> getApplicationScopeMappings(@PathParam("appId") String appId) {
ApplicationModel app = realm.getApplicationById(appId);
public List<RoleRepresentation> getApplicationScopeMappings(@PathParam("app") String appName) {
ApplicationModel app = realm.getApplicationByName(appName);
if (app == null) {
throw new NotFoundException();
@ -145,11 +145,11 @@ public class ScopeMappedResource {
return mapRep;
}
@Path("applications/{appId}")
@Path("applications/{app}")
@POST
@Consumes("application/json")
public void addApplicationScopeMapping(@PathParam("appId") String appId, List<RoleRepresentation> roles) {
ApplicationModel app = realm.getApplicationById(appId);
public void addApplicationScopeMapping(@PathParam("app") String appName, List<RoleRepresentation> roles) {
ApplicationModel app = realm.getApplicationByName(appName);
if (app == null) {
throw new NotFoundException();
@ -165,11 +165,11 @@ public class ScopeMappedResource {
}
@Path("applications/{appId}")
@Path("applications/{app}")
@DELETE
@Consumes("application/json")
public void deleteApplicationRoleMapping(@PathParam("appId") String appId, List<RoleRepresentation> roles) {
ApplicationModel app = realm.getApplicationById(appId);
public void deleteApplicationRoleMapping(@PathParam("app") String appName, List<RoleRepresentation> roles) {
ApplicationModel app = realm.getApplicationByName(appName);
if (app == null) {
throw new NotFoundException();
@ -190,4 +190,5 @@ public class ScopeMappedResource {
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
@Produces("application/json")
@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");
UserModel user = realm.getUser(username);
@ -294,7 +294,7 @@ public class UsersResource {
throw new NotFoundException();
}
ApplicationModel application = realm.getApplicationById(appId);
ApplicationModel application = realm.getApplicationByName(appName);
if (application == null) {
throw new NotFoundException();
@ -309,17 +309,17 @@ public class UsersResource {
return mapRep;
}
@Path("{username}/role-mappings/applications/{appId}")
@Path("{username}/role-mappings/applications/{app}")
@POST
@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");
UserModel user = realm.getUser(username);
if (user == null) {
throw new NotFoundException();
}
ApplicationModel application = realm.getApplicationById(appId);
ApplicationModel application = realm.getApplicationByName(appName);
if (application == null) {
throw new NotFoundException();
@ -335,16 +335,16 @@ public class UsersResource {
}
@Path("{username}/role-mappings/applications/{appId}")
@Path("{username}/role-mappings/applications/{app}")
@DELETE
@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);
if (user == null) {
throw new NotFoundException();
}
ApplicationModel application = realm.getApplicationById(appId);
ApplicationModel application = realm.getApplicationByName(appName);
if (application == null) {
throw new NotFoundException();