From bf7a173e1e2a7666d019b4131cbb64c504b956b2 Mon Sep 17 00:00:00 2001 From: Grzegorz Grzybek Date: Tue, 22 May 2018 11:52:08 +0200 Subject: [PATCH] [KEYCLOAK-7394] Change Content-Type to x-www-form-urlencoded for RealmAdminResource#testLDAPConnection --- .../base/admin/resources/js/controllers/users.js | 4 ++-- .../theme/base/admin/resources/js/services.js | 14 ++++++++++++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/themes/src/main/resources/theme/base/admin/resources/js/controllers/users.js b/themes/src/main/resources/theme/base/admin/resources/js/controllers/users.js index 7ca8d43f3c..43d45b361c 100755 --- a/themes/src/main/resources/theme/base/admin/resources/js/controllers/users.js +++ b/themes/src/main/resources/theme/base/admin/resources/js/controllers/users.js @@ -1322,7 +1322,7 @@ module.controller('LDAPUserStorageCtrl', function($scope, $location, Notificatio $scope.testConnection = function() { console.log('LDAPCtrl: testConnection'); - RealmLDAPConnectionTester.post(initConnectionTest("testConnection", $scope.instance.config), function() { + RealmLDAPConnectionTester.save(initConnectionTest("testConnection", $scope.instance.config), function() { Notifications.success("LDAP connection successful."); }, function() { Notifications.error("Error when trying to connect to LDAP. See server.log for details."); @@ -1331,7 +1331,7 @@ module.controller('LDAPUserStorageCtrl', function($scope, $location, Notificatio $scope.testAuthentication = function() { console.log('LDAPCtrl: testAuthentication'); - RealmLDAPConnectionTester.post(initConnectionTest("testAuthentication", $scope.instance.config), function() { + RealmLDAPConnectionTester.save(initConnectionTest("testAuthentication", $scope.instance.config), function() { Notifications.success("LDAP authentication successful."); }, function() { Notifications.error("LDAP authentication failed. See server.log for details"); diff --git a/themes/src/main/resources/theme/base/admin/resources/js/services.js b/themes/src/main/resources/theme/base/admin/resources/js/services.js index 2517ae943e..f53cbe5d30 100755 --- a/themes/src/main/resources/theme/base/admin/resources/js/services.js +++ b/themes/src/main/resources/theme/base/admin/resources/js/services.js @@ -349,8 +349,18 @@ module.factory('RegisterRequiredAction', function($resource) { }); }); -module.factory('RealmLDAPConnectionTester', function($resource) { - return $resource(authUrl + '/admin/realms/:realm/testLDAPConnection'); +module.factory('RealmLDAPConnectionTester', function($resource, $httpParamSerializer) { + return $resource(authUrl + '/admin/realms/:realm/testLDAPConnection', { + realm : '@realm' + }, { + save: { + method: 'POST', + headers : { 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8' }, + transformRequest: function (data) { + return $httpParamSerializer(data) + } + } + }); }); module.factory('RealmSMTPConnectionTester', function($resource) {