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 @@ -