diff --git a/admin-ui/src/main/resources/META-INF/resources/admin/js/controllers/applications.js b/admin-ui/src/main/resources/META-INF/resources/admin/js/controllers/applications.js index d7416a07e3..800c7e39ca 100755 --- a/admin-ui/src/main/resources/META-INF/resources/admin/js/controllers/applications.js +++ b/admin-ui/src/main/resources/META-INF/resources/admin/js/controllers/applications.js @@ -217,16 +217,43 @@ module.controller('ApplicationInstallationCtrl', function($scope, realm, applica module.controller('ApplicationDetailCtrl', function($scope, realm, application, Application, $location, Dialog, Notifications) { console.log('ApplicationDetailCtrl'); + $scope.clientTypes = [ + "confidential", + "public", + "bearer-only" + ]; + $scope.realm = realm; $scope.create = !application.name; if (!$scope.create) { $scope.application= angular.copy(application); + $scope.clientType = $scope.clientTypes[0]; + if (application.bearerOnly) { + $scope.clientType = $scope.clientTypes[2]; + } else if (application.publicClient) { + $scope.clientType = $scope.clientTypes[1]; + } } else { $scope.application = {}; $scope.application.webOrigins = []; $scope.application.redirectUris = []; + $scope.clientType = $scope.clientTypes[0]; } + $scope.changeClientType = function() { + console.log('Client Type: ' + $scope.clientType); + if ($scope.clientType == "confidential") { + $scope.application.bearerOnly = false; + $scope.application.publicClient = false; + } else if ($scope.clientType == "public") { + $scope.application.bearerOnly = false; + $scope.application.publicClient = true; + } else if ($scope.clientType == "bearer-only") { + $scope.application.bearerOnly = true; + $scope.application.publicClient = false; + } + }; + $scope.$watch(function() { return $location.path(); }, function() { diff --git a/admin-ui/src/main/resources/META-INF/resources/admin/js/controllers/oauth-clients.js b/admin-ui/src/main/resources/META-INF/resources/admin/js/controllers/oauth-clients.js index 5279f15ad1..54ca912ca4 100755 --- a/admin-ui/src/main/resources/META-INF/resources/admin/js/controllers/oauth-clients.js +++ b/admin-ui/src/main/resources/META-INF/resources/admin/js/controllers/oauth-clients.js @@ -76,12 +76,33 @@ module.controller('OAuthClientListCtrl', function($scope, realm, oauthClients, O module.controller('OAuthClientDetailCtrl', function($scope, realm, oauth, OAuthClient, $location, Dialog, Notifications) { $scope.realm = realm; $scope.create = !oauth.id; + + $scope.clientTypes = [ + "confidential", + "public" + ]; + + $scope.changeClientType = function() { + console.log('Client Type: ' + $scope.clientType); + if ($scope.clientType == "confidential") { + $scope.oauth.publicClient = false; + } else if ($scope.clientType == "public") { + $scope.oauth.publicClient = true; + } + }; + + if (!$scope.create) { $scope.oauth= angular.copy(oauth); + $scope.clientType = $scope.clientTypes[0]; + if (oauth.publicClient) { + $scope.clientType = $scope.clientTypes[1]; + } } else { $scope.oauth = {}; $scope.oauth.webOrigins = []; $scope.oauth.redirectUris = []; + $scope.clientType = $scope.clientTypes[0]; } $scope.$watch(function() { diff --git a/admin-ui/src/main/resources/META-INF/resources/admin/partials/application-detail.html b/admin-ui/src/main/resources/META-INF/resources/admin/partials/application-detail.html index 6cde4cd664..09ff0d19a8 100755 --- a/admin-ui/src/main/resources/META-INF/resources/admin/partials/application-detail.html +++ b/admin-ui/src/main/resources/META-INF/resources/admin/partials/application-detail.html @@ -39,16 +39,16 @@ -
- +
+
- -
-
-
- -
- +
+ +
diff --git a/admin-ui/src/main/resources/META-INF/resources/admin/partials/oauth-client-detail.html b/admin-ui/src/main/resources/META-INF/resources/admin/partials/oauth-client-detail.html index a279e7c83f..5fe0e99c69 100755 --- a/admin-ui/src/main/resources/META-INF/resources/admin/partials/oauth-client-detail.html +++ b/admin-ui/src/main/resources/META-INF/resources/admin/partials/oauth-client-detail.html @@ -40,10 +40,16 @@
-
- +
+
- +
+ +
diff --git a/services/src/main/java/org/keycloak/services/managers/OAuthClientManager.java b/services/src/main/java/org/keycloak/services/managers/OAuthClientManager.java index b808089140..184de4e155 100755 --- a/services/src/main/java/org/keycloak/services/managers/OAuthClientManager.java +++ b/services/src/main/java/org/keycloak/services/managers/OAuthClientManager.java @@ -44,13 +44,6 @@ public class OAuthClientManager { public OAuthClientModel create(OAuthClientRepresentation rep) { OAuthClientModel model = create(rep.getName()); update(rep, model); - model.setSecret(rep.getSecret()); - if (rep.getClaims() != null) { - ClaimManager.setClaims(model, rep.getClaims()); - } - if (rep.getNotBefore() != null) { - model.setNotBefore(rep.getNotBefore()); - } return model; } @@ -58,6 +51,13 @@ public class OAuthClientManager { if (rep.getName() != null) model.setClientId(rep.getName()); if (rep.isEnabled() != null) model.setEnabled(rep.isEnabled()); if (rep.isPublicClient() != null) model.setPublicClient(rep.isPublicClient()); + if (rep.getClaims() != null) { + ClaimManager.setClaims(model, rep.getClaims()); + } + if (rep.getNotBefore() != null) { + model.setNotBefore(rep.getNotBefore()); + } + if (rep.getSecret() != null) model.setSecret(rep.getSecret()); List redirectUris = rep.getRedirectUris(); if (redirectUris != null) { model.setRedirectUris(new HashSet(redirectUris));