From 14d1d137c0db3e9ae9ef1bbf1fbf860c4635fd00 Mon Sep 17 00:00:00 2001 From: Nuvindu Date: Fri, 3 Nov 2023 11:25:05 +0530 Subject: [PATCH] Fix formatting in payloads --- .../soap11/tests/http_soap_service.bal | 55 +++++++++++-------- .../soap12/tests/http_soap_service.bal | 32 +++++++---- 2 files changed, 53 insertions(+), 34 deletions(-) diff --git a/ballerina/modules/soap11/tests/http_soap_service.bal b/ballerina/modules/soap11/tests/http_soap_service.bal index 72eb50e..98f561f 100644 --- a/ballerina/modules/soap11/tests/http_soap_service.bal +++ b/ballerina/modules/soap11/tests/http_soap_service.bal @@ -13,7 +13,6 @@ // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. - import ballerina/crypto; import ballerina/http; import ballerina/mime; @@ -24,7 +23,7 @@ const crypto:KeyStore serverKeyStore = { password: KEY_PASSWORD }; crypto:PrivateKey serverPrivateKey = check crypto:decodeRsaPrivateKeyFromKeyStore(serverKeyStore, KEY_ALIAS, - KEY_PASSWORD); + KEY_PASSWORD); crypto:PublicKey serverPublicKey = check crypto:decodeRsaPublicKeyFromTrustStore(serverKeyStore, KEY_ALIAS); service / on new http:Listener(9090) { @@ -59,18 +58,24 @@ service / on new http:Listener(9090) { xml payload = check (check request.getBodyParts())[0].getXml(); xml applyOutboundConfig = check soap:applyOutboundConfig( { - verificationKey: clientPublicKey, - signatureAlgorithm: soap:RSA_SHA256, - decryptionAlgorithm: soap:RSA_ECB, - decryptionKey: serverPrivateKey - }, payload, false); + verificationKey: clientPublicKey, + signatureAlgorithm: soap:RSA_SHA256, + decryptionAlgorithm: soap:RSA_ECB, + decryptionKey: serverPrivateKey + }, + payload, + false + ); xml securedEnv = check soap:applySecurityPolicies( { - signatureAlgorithm: soap:RSA_SHA256, - encryptionAlgorithm: soap:RSA_ECB, - signatureKey: serverPrivateKey, - encryptionKey: clientPublicKey - }, applyOutboundConfig, false); + signatureAlgorithm: soap:RSA_SHA256, + encryptionAlgorithm: soap:RSA_ECB, + signatureKey: serverPrivateKey, + encryptionKey: clientPublicKey + }, + applyOutboundConfig, + false + ); http:Response response = new; mime:Entity[] mtomMessage = []; mime:Entity envelope = new; @@ -87,18 +92,24 @@ service / on new http:Listener(9090) { xml payload = check request.getXmlPayload(); xml applyOutboundConfig = check soap:applyOutboundConfig( { - verificationKey: clientPublicKey, - signatureAlgorithm: soap:RSA_SHA256, - decryptionAlgorithm: soap:RSA_ECB, - decryptionKey: serverPrivateKey - }, payload, false); + verificationKey: clientPublicKey, + signatureAlgorithm: soap:RSA_SHA256, + decryptionAlgorithm: soap:RSA_ECB, + decryptionKey: serverPrivateKey + }, + payload, + false + ); xml securedEnv = check soap:applySecurityPolicies( { - signatureAlgorithm: soap:RSA_SHA256, - encryptionAlgorithm: soap:RSA_ECB, - signatureKey: serverPrivateKey, - encryptionKey: clientPublicKey - }, applyOutboundConfig, false); + signatureAlgorithm: soap:RSA_SHA256, + encryptionAlgorithm: soap:RSA_ECB, + signatureKey: serverPrivateKey, + encryptionKey: clientPublicKey + }, + applyOutboundConfig, + false + ); http:Response response = new; response.setPayload(securedEnv); return response; diff --git a/ballerina/modules/soap12/tests/http_soap_service.bal b/ballerina/modules/soap12/tests/http_soap_service.bal index 0191aaf..f4cc2bd 100644 --- a/ballerina/modules/soap12/tests/http_soap_service.bal +++ b/ballerina/modules/soap12/tests/http_soap_service.bal @@ -63,14 +63,18 @@ service / on new http:Listener(9090) { signatureAlgorithm: soap:RSA_SHA256, decryptionAlgorithm: soap:RSA_ECB, decryptionKey: serverPrivateKey - }, payload); + }, + payload + ); xml securedEnv = check soap:applySecurityPolicies( { signatureAlgorithm: soap:RSA_SHA256, encryptionAlgorithm: soap:RSA_ECB, signatureKey: serverPrivateKey, encryptionKey: clientPublicKey - }, applyOutboundConfig); + }, + applyOutboundConfig + ); http:Response response = new; response.setPayload(securedEnv); return response; @@ -80,18 +84,22 @@ service / on new http:Listener(9090) { xml payload = check (check request.getBodyParts())[0].getXml(); xml applyOutboundConfig = check soap:applyOutboundConfig( { - verificationKey: clientPublicKey, - signatureAlgorithm: soap:RSA_SHA256, - decryptionAlgorithm: soap:RSA_ECB, - decryptionKey: serverPrivateKey - }, payload); + verificationKey: clientPublicKey, + signatureAlgorithm: soap:RSA_SHA256, + decryptionAlgorithm: soap:RSA_ECB, + decryptionKey: serverPrivateKey + }, + payload + ); xml securedEnv = check soap:applySecurityPolicies( { - signatureAlgorithm: soap:RSA_SHA256, - encryptionAlgorithm: soap:RSA_ECB, - signatureKey: serverPrivateKey, - encryptionKey: clientPublicKey - }, applyOutboundConfig); + signatureAlgorithm: soap:RSA_SHA256, + encryptionAlgorithm: soap:RSA_ECB, + signatureKey: serverPrivateKey, + encryptionKey: clientPublicKey + }, + applyOutboundConfig + ); http:Response response = new; mime:Entity[] mtomMessage = []; mime:Entity envelope = new;