[KEYCLOAK-7394] Change Content-Type to x-www-form-urlencoded for RealmAdminResource#testLDAPConnection

This commit is contained in:
Grzegorz Grzybek 2018-05-22 11:52:08 +02:00 committed by Bruno Oliveira da Silva
parent 2077975b1c
commit bf7a173e1e
2 changed files with 14 additions and 4 deletions

View file

@ -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");

View file

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