diff --git a/integration/admin-client/src/main/java/org/keycloak/admin/client/resource/RealmResource.java b/integration/admin-client/src/main/java/org/keycloak/admin/client/resource/RealmResource.java index 387ad417ff..ffec3424cf 100644 --- a/integration/admin-client/src/main/java/org/keycloak/admin/client/resource/RealmResource.java +++ b/integration/admin-client/src/main/java/org/keycloak/admin/client/resource/RealmResource.java @@ -213,11 +213,11 @@ public interface RealmResource { @FormParam("bindDn") String bindDn, @FormParam("bindCredential") String bindCredential, @FormParam("useTruststoreSpi") String useTruststoreSpi, @FormParam("connectionTimeout") String connectionTimeout); - @Path("testSMTPConnection/{config}") + @Path("testSMTPConnection") @POST @NoCache @Consumes(MediaType.APPLICATION_JSON) - Response testSMTPConnection(final @PathParam("config") String config) throws Exception; + Response testSMTPConnection(@FormParam("config") String config); @Path("clear-realm-cache") @POST diff --git a/services/src/main/java/org/keycloak/services/resources/admin/RealmAdminResource.java b/services/src/main/java/org/keycloak/services/resources/admin/RealmAdminResource.java index b0b2c1fc7a..4ca060fac1 100644 --- a/services/src/main/java/org/keycloak/services/resources/admin/RealmAdminResource.java +++ b/services/src/main/java/org/keycloak/services/resources/admin/RealmAdminResource.java @@ -947,10 +947,10 @@ public class RealmAdminResource { * @return * @throws Exception */ - @Path("testSMTPConnection/{config}") + @Path("testSMTPConnection") @POST @NoCache - public Response testSMTPConnection(final @PathParam("config") String config) throws Exception { + public Response testSMTPConnection(final @FormParam("config") String config) throws Exception { Map settings = readValue(config, new TypeReference>() { }); 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 4329a38a46..1ceda107bd 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 @@ -440,13 +440,16 @@ module.factory('RealmLDAPConnectionTester', function($resource, $httpParamSerial }); }); -module.factory('RealmSMTPConnectionTester', function($resource) { - return $resource(authUrl + '/admin/realms/:realm/testSMTPConnection/:config', { - realm : '@realm', - config : '@config' +module.factory('RealmSMTPConnectionTester', function($resource, $httpParamSerializer) { + return $resource(authUrl + '/admin/realms/:realm/testSMTPConnection', { + realm : '@realm' }, { send: { - method: 'POST' + method: 'POST', + headers : { 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8' }, + transformRequest: function (data) { + return $httpParamSerializer(data) + } } }); });