diff --git a/forms/common-themes/src/main/resources/theme/admin/base/resources/js/controllers/oauth-clients.js b/forms/common-themes/src/main/resources/theme/admin/base/resources/js/controllers/oauth-clients.js
index 9241e4b543..511efe69f6 100755
--- a/forms/common-themes/src/main/resources/theme/admin/base/resources/js/controllers/oauth-clients.js
+++ b/forms/common-themes/src/main/resources/theme/admin/base/resources/js/controllers/oauth-clients.js
@@ -17,7 +17,7 @@ module.controller('OAuthClientClaimsCtrl', function($scope, realm, oauth, claims
$scope.save = function () {
OAuthClientClaims.update({
realm: realm.realm,
- oauth: oauth.id
+ oauth: oauth.name
}, $scope.claims, function () {
$scope.changed = false;
claims = angular.copy($scope.claims);
@@ -27,7 +27,7 @@ module.controller('OAuthClientClaimsCtrl', function($scope, realm, oauth, claims
};
$scope.reset = function () {
- $location.url("/realms/" + realm.realm + "/oauth-clients/" + oauth.id + "/claims");
+ $location.url("/realms/" + realm.realm + "/oauth-clients/" + oauth.name + "/claims");
};
});
@@ -36,14 +36,14 @@ module.controller('OAuthClientCredentialsCtrl', function($scope, $location, real
$scope.realm = realm;
$scope.oauth = oauth;
- var secret = OAuthClientCredentials.get({ realm : realm.realm, oauth : oauth.id },
+ var secret = OAuthClientCredentials.get({ realm : realm.realm, oauth : oauth.name },
function() {
$scope.secret = secret.value;
}
);
$scope.changePassword = function() {
- var secret = OAuthClientCredentials.update({ realm : realm.realm, oauth : oauth.id },
+ var secret = OAuthClientCredentials.update({ realm : realm.realm, oauth : oauth.name },
function() {
Notifications.success('The secret has been changed.');
$scope.secret = secret.value;
@@ -141,14 +141,14 @@ module.controller('OAuthClientDetailCtrl', function($scope, realm, oauth, OAuthC
}, $scope.oauth, function (data, headers) {
$scope.changed = false;
var l = headers().location;
- var id = l.substring(l.lastIndexOf("/") + 1);
- $location.url("/realms/" + realm.realm + "/oauth-clients/" + id);
+ var name = l.substring(l.lastIndexOf("/") + 1);
+ $location.url("/realms/" + realm.realm + "/oauth-clients/" + name);
Notifications.success("The oauth client has been created.");
});
} else {
OAuthClient.update({
realm : realm.realm,
- id : oauth.id
+ oauth : oauth.name
}, $scope.oauth, function() {
$scope.changed = false;
oauth = angular.copy($scope.oauth);
@@ -171,7 +171,7 @@ module.controller('OAuthClientDetailCtrl', function($scope, realm, oauth, OAuthC
Dialog.confirmDelete($scope.oauth.name, 'oauth', function() {
$scope.oauth.$remove({
realm : realm.realm,
- id : $scope.oauth.id
+ oauth : $scope.oauth.name
}, function() {
$location.url("/realms/" + realm.realm + "/oauth-clients");
Notifications.success("The oauth client has been deleted.");
@@ -200,17 +200,17 @@ module.controller('OAuthClientScopeMappingCtrl', function($scope, $http, realm,
$scope.dummymodel = [];
function updateRealmRoles() {
- $scope.realmRoles = OAuthClientAvailableRealmScopeMapping.query({realm : realm.realm, oauth : oauth.id});
- $scope.realmMappings = OAuthClientRealmScopeMapping.query({realm : realm.realm, oauth : oauth.id});
- $scope.realmComposite = OAuthClientCompositeRealmScopeMapping.query({realm : realm.realm, oauth : oauth.id});
+ $scope.realmRoles = OAuthClientAvailableRealmScopeMapping.query({realm : realm.realm, oauth : oauth.name});
+ $scope.realmMappings = OAuthClientRealmScopeMapping.query({realm : realm.realm, oauth : oauth.name});
+ $scope.realmComposite = OAuthClientCompositeRealmScopeMapping.query({realm : realm.realm, oauth : oauth.name});
}
function updateAppRoles() {
if ($scope.targetApp) {
console.debug($scope.targetApp.name);
- $scope.applicationRoles = OAuthClientAvailableApplicationScopeMapping.query({realm : realm.realm, oauth : oauth.id, targetApp : $scope.targetApp.name});
- $scope.applicationMappings = OAuthClientApplicationScopeMapping.query({realm : realm.realm, oauth : oauth.id, targetApp : $scope.targetApp.name});
- $scope.applicationComposite = OAuthClientCompositeApplicationScopeMapping.query({realm : realm.realm, oauth : oauth.id, targetApp : $scope.targetApp.name});
+ $scope.applicationRoles = OAuthClientAvailableApplicationScopeMapping.query({realm : realm.realm, oauth : oauth.name, targetApp : $scope.targetApp.name});
+ $scope.applicationMappings = OAuthClientApplicationScopeMapping.query({realm : realm.realm, oauth : oauth.name, targetApp : $scope.targetApp.name});
+ $scope.applicationComposite = OAuthClientCompositeApplicationScopeMapping.query({realm : realm.realm, oauth : oauth.name, targetApp : $scope.targetApp.name});
} else {
$scope.applicationRoles = null;
$scope.applicationMappings = null;
@@ -219,23 +219,23 @@ module.controller('OAuthClientScopeMappingCtrl', function($scope, $http, realm,
}
$scope.addRealmRole = function() {
- $http.post(authUrl + '/admin/realms/' + realm.realm + '/oauth-clients/' + oauth.id + '/scope-mappings/realm', $scope.selectedRealmRoles)
+ $http.post(authUrl + '/admin/realms/' + realm.realm + '/oauth-clients/' + oauth.name + '/scope-mappings/realm', $scope.selectedRealmRoles)
.success(updateRealmRoles);
};
$scope.deleteRealmRole = function() {
- $http.delete(authUrl + '/admin/realms/' + realm.realm + '/oauth-clients/' + oauth.id + '/scope-mappings/realm',
+ $http.delete(authUrl + '/admin/realms/' + realm.realm + '/oauth-clients/' + oauth.name + '/scope-mappings/realm',
{data : $scope.selectedRealmMappings, headers : {"content-type" : "application/json"}})
.success(updateRealmRoles);
};
$scope.addApplicationRole = function() {
- $http.post(authUrl + '/admin/realms/' + realm.realm + '/oauth-clients/' + oauth.id + '/scope-mappings/applications/' + $scope.targetApp.name,
+ $http.post(authUrl + '/admin/realms/' + realm.realm + '/oauth-clients/' + oauth.name + '/scope-mappings/applications/' + $scope.targetApp.name,
$scope.selectedApplicationRoles).success(updateAppRoles);
};
$scope.deleteApplicationRole = function() {
- $http.delete(authUrl + '/admin/realms/' + realm.realm + '/oauth-clients/' + oauth.id + '/scope-mappings/applications/' + $scope.targetApp.name,
+ $http.delete(authUrl + '/admin/realms/' + realm.realm + '/oauth-clients/' + oauth.name + '/scope-mappings/applications/' + $scope.targetApp.name,
{data : $scope.selectedApplicationMappings, headers : {"content-type" : "application/json"}}).success(updateAppRoles);
};
@@ -244,22 +244,22 @@ module.controller('OAuthClientScopeMappingCtrl', function($scope, $http, realm,
};
$scope.addRealmRole = function() {
- $http.post(authUrl + '/admin/realms/' + realm.realm + '/oauth-clients/' + oauth.id + '/scope-mappings/realm',
+ $http.post(authUrl + '/admin/realms/' + realm.realm + '/oauth-clients/' + oauth.name + '/scope-mappings/realm',
$scope.selectedRealmRoles).success(updateRealmRoles);
};
$scope.deleteRealmRole = function() {
- $http.delete(authUrl + '/admin/realms/' + realm.realm + '/oauth-clients/' + oauth.id + '/scope-mappings/realm',
+ $http.delete(authUrl + '/admin/realms/' + realm.realm + '/oauth-clients/' + oauth.name + '/scope-mappings/realm',
{data : $scope.selectedRealmMappings, headers : {"content-type" : "application/json"}}).success(updateRealmRoles);
};
$scope.addApplicationRole = function() {
- $http.post(authUrl + '/admin/realms/' + realm.realm + '/oauth-clients/' + oauth.id + '/scope-mappings/applications/' + $scope.targetApp.name,
+ $http.post(authUrl + '/admin/realms/' + realm.realm + '/oauth-clients/' + oauth.name + '/scope-mappings/applications/' + $scope.targetApp.name,
$scope.selectedApplicationRoles).success(updateAppRoles);
};
$scope.deleteApplicationRole = function() {
- $http.delete(authUrl + '/admin/realms/' + realm.realm + '/oauth-clients/' + oauth.id + '/scope-mappings/applications/' + $scope.targetApp.name,
+ $http.delete(authUrl + '/admin/realms/' + realm.realm + '/oauth-clients/' + oauth.name + '/scope-mappings/applications/' + $scope.targetApp.name,
{data : $scope.selectedApplicationMappings, headers : {"content-type" : "application/json"}}).success(updateAppRoles);
};
@@ -287,7 +287,7 @@ module.controller('OAuthClientRevocationCtrl', function($scope, realm, oauth, OA
setNotBefore();
var refresh = function() {
- OAuthClient.get({ realm : realm.realm, id: $scope.oauth.id }, function(updated) {
+ OAuthClient.get({ realm : realm.realm, oauth: $scope.oauth.name }, function(updated) {
$scope.oauth = updated;
setNotBefore();
})
@@ -296,7 +296,7 @@ module.controller('OAuthClientRevocationCtrl', function($scope, realm, oauth, OA
$scope.clear = function() {
$scope.oauth.notBefore = 0;
- OAuthClient.update({ realm : realm.realm, id: $scope.oauth.id}, $scope.oauth, function () {
+ OAuthClient.update({ realm : realm.realm, oauth: $scope.oauth.name}, $scope.oauth, function () {
$scope.notBefore = "None";
Notifications.success('Not Before cleared for application.');
refresh();
@@ -304,7 +304,7 @@ module.controller('OAuthClientRevocationCtrl', function($scope, realm, oauth, OA
}
$scope.setNotBeforeNow = function() {
$scope.oauth.notBefore = new Date().getTime()/1000;
- OAuthClient.update({ realm : realm.realm, id: $scope.oauth.id}, $scope.oauth, function () {
+ OAuthClient.update({ realm : realm.realm, oauth: $scope.oauth.name}, $scope.oauth, function () {
Notifications.success('Not Before cleared for application.');
refresh();
});
diff --git a/forms/common-themes/src/main/resources/theme/admin/base/resources/js/loaders.js b/forms/common-themes/src/main/resources/theme/admin/base/resources/js/loaders.js
index 81a77b7be2..139d507c1f 100755
--- a/forms/common-themes/src/main/resources/theme/admin/base/resources/js/loaders.js
+++ b/forms/common-themes/src/main/resources/theme/admin/base/resources/js/loaders.js
@@ -222,7 +222,7 @@ module.factory('OAuthClientLoader', function(Loader, OAuthClient, $route, $q) {
return Loader.get(OAuthClient, function() {
return {
realm : $route.current.params.realm,
- id : $route.current.params.oauth
+ oauth : $route.current.params.oauth
}
});
});
diff --git a/forms/common-themes/src/main/resources/theme/admin/base/resources/js/services.js b/forms/common-themes/src/main/resources/theme/admin/base/resources/js/services.js
index 57a3a27130..f0a4114db5 100755
--- a/forms/common-themes/src/main/resources/theme/admin/base/resources/js/services.js
+++ b/forms/common-themes/src/main/resources/theme/admin/base/resources/js/services.js
@@ -727,9 +727,9 @@ module.factory('ApplicationOrigins', function($resource) {
});
module.factory('OAuthClient', function($resource) {
- return $resource(authUrl + '/admin/realms/:realm/oauth-clients/:id', {
+ return $resource(authUrl + '/admin/realms/:realm/oauth-clients/:oauth', {
realm : '@realm',
- id : '@id'
+ oauth : '@oauth'
}, {
update : {
method : 'PUT'
diff --git a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/oauth-client-claims.html b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/oauth-client-claims.html
index 564ab6f4d5..b671c55887 100755
--- a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/oauth-client-claims.html
+++ b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/oauth-client-claims.html
@@ -1,12 +1,12 @@
diff --git a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/oauth-client-credentials.html b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/oauth-client-credentials.html
index 6c53c42dd2..d4308642a8 100755
--- a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/oauth-client-credentials.html
+++ b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/oauth-client-credentials.html
@@ -1,12 +1,12 @@
diff --git a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/oauth-client-detail.html b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/oauth-client-detail.html
index c5154d8070..c32a655e28 100755
--- a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/oauth-client-detail.html
+++ b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/oauth-client-detail.html
@@ -1,12 +1,12 @@
diff --git a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/oauth-client-installation.html b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/oauth-client-installation.html
index d547469d9c..ed3a39caac 100755
--- a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/oauth-client-installation.html
+++ b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/oauth-client-installation.html
@@ -1,18 +1,18 @@
- {{realm.realm}}
- OAuth Clients
- - {{oauth.name}}
+ - {{oauth.name}}
- Installation
OAuth Client Installation
diff --git a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/oauth-client-list.html b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/oauth-client-list.html
index 6689b7322c..bbc46a5a23 100755
--- a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/oauth-client-list.html
+++ b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/oauth-client-list.html
@@ -46,7 +46,7 @@
-->
- {{client.name}} |
+ {{client.name}} |
{{client.enabled}} |
diff --git a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/oauth-client-revocation.html b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/oauth-client-revocation.html
index ef7f08c894..514c9f27a0 100755
--- a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/oauth-client-revocation.html
+++ b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/oauth-client-revocation.html
@@ -1,18 +1,18 @@
- {{realm.realm}}
- OAuth Clients
- - {{oauth.name}}
+ - {{oauth.name}}
- Revocation
{{oauth.name}} Revocation Policies
diff --git a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/oauth-client-scope-mappings.html b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/oauth-client-scope-mappings.html
index 67bc4161e4..f74ca47163 100755
--- a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/oauth-client-scope-mappings.html
+++ b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/oauth-client-scope-mappings.html
@@ -2,19 +2,19 @@
- {{realm.realm}}
- OAuth Clients
- - {{oauth.name}}
+ - {{oauth.name}}
- Scope
{{oauth.name}} Scope Mappings
diff --git a/services/src/main/java/org/keycloak/services/resources/admin/OAuthClientsResource.java b/services/src/main/java/org/keycloak/services/resources/admin/OAuthClientsResource.java
index 3bb4144166..612f539935 100755
--- a/services/src/main/java/org/keycloak/services/resources/admin/OAuthClientsResource.java
+++ b/services/src/main/java/org/keycloak/services/resources/admin/OAuthClientsResource.java
@@ -90,7 +90,7 @@ public class OAuthClientsResource {
try {
OAuthClientModel oauth = RepresentationToModel.createOAuthClient(rep, realm);
- return Response.created(uriInfo.getAbsolutePathBuilder().path(oauth.getId()).build()).build();
+ return Response.created(uriInfo.getAbsolutePathBuilder().path(oauth.getClientId()).build()).build();
} catch (ModelDuplicateException e) {
return Flows.errors().exists("Client " + rep.getName() + " already exists");
}
@@ -99,14 +99,14 @@ public class OAuthClientsResource {
/**
* Base path to manage one specific oauth client
*
- * @param id oauth client's id (not clientId!)
+ * @param clientId oauth client's clientId
* @return
*/
- @Path("{id}")
- public OAuthClientResource getOAuthClient(final @PathParam("id") String id) {
+ @Path("{clientId}")
+ public OAuthClientResource getOAuthClient(final @PathParam("clientId") String clientId) {
auth.requireView();
- OAuthClientModel oauth = realm.getOAuthClientById(id);
+ OAuthClientModel oauth = realm.getOAuthClient(clientId);
if (oauth == null) {
throw new NotFoundException("OAuth Client not found");
}
diff --git a/testsuite/integration/src/test/java/org/keycloak/testsuite/admin/OAuthClientTest.java b/testsuite/integration/src/test/java/org/keycloak/testsuite/admin/OAuthClientTest.java
index e66a8ea1a2..421977562f 100644
--- a/testsuite/integration/src/test/java/org/keycloak/testsuite/admin/OAuthClientTest.java
+++ b/testsuite/integration/src/test/java/org/keycloak/testsuite/admin/OAuthClientTest.java
@@ -28,8 +28,6 @@ public class OAuthClientTest extends AbstractClientTest {
}
@Test
- @Ignore
- // TODO For some reason clients are retrieved using id, not client-id
public void removeOAuthClient() {
createOAuthClient();
@@ -37,8 +35,6 @@ public class OAuthClientTest extends AbstractClientTest {
}
@Test
- @Ignore
- // TODO For some reason clients are retrieved using id, not client-id
public void getOAuthClientRepresentation() {
createOAuthClient();