diff --git a/forms/common-themes/src/main/resources/theme/base/admin/resources/js/controllers/clients.js b/forms/common-themes/src/main/resources/theme/base/admin/resources/js/controllers/clients.js index eb58ca0d8e..b0853cb242 100755 --- a/forms/common-themes/src/main/resources/theme/base/admin/resources/js/controllers/clients.js +++ b/forms/common-themes/src/main/resources/theme/base/admin/resources/js/controllers/clients.js @@ -1055,8 +1055,10 @@ module.controller('CreateClientCtrl', function($scope, realm, client, templates, 'saml'];//Object.keys(serverInfo.providers['login-protocol'].providers).sort(); $scope.create = true; $scope.templates = [ {name:'NONE'}]; + var templateNameMap = new Object(); for (var i = 0; i < templates.length; i++) { var template = templates[i]; + templateNameMap[template.name] = template; $scope.templates.push(template); } @@ -1096,6 +1098,18 @@ module.controller('CreateClientCtrl', function($scope, realm, client, templates, $scope.changed = true; } + $scope.changeTemplate = function() { + if ($scope.client.clientTemplate == 'NONE') { + $scope.protocol = 'openid-connect'; + $scope.client.protocol = 'openid-connect'; + $scope.client.clientTemplate = null; + + } else { + var template = templateNameMap[$scope.client.clientTemplate]; + $scope.protocol = template.protocol; + $scope.client.protocol = template.protocol; + } + } $scope.changeProtocol = function() { if ($scope.protocol == "openid-connect") { $scope.client.protocol = "openid-connect"; diff --git a/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/create-client.html b/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/create-client.html index dd2a9626b6..e1a56de483 100755 --- a/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/create-client.html +++ b/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/create-client.html @@ -37,7 +37,8 @@ @@ -48,6 +49,7 @@
diff --git a/services/src/main/java/org/keycloak/services/resources/admin/ClientTemplatesResource.java b/services/src/main/java/org/keycloak/services/resources/admin/ClientTemplatesResource.java index 6a65875ae8..c52fb1d2b4 100755 --- a/services/src/main/java/org/keycloak/services/resources/admin/ClientTemplatesResource.java +++ b/services/src/main/java/org/keycloak/services/resources/admin/ClientTemplatesResource.java @@ -75,6 +75,7 @@ public class ClientTemplatesResource { client.setId(clientModel.getId()); client.setName(clientModel.getName()); client.setDescription(clientModel.getDescription()); + client.setProtocol(clientModel.getProtocol()); rep.add(client); } }