diff --git a/ballerina/Ballerina.toml b/ballerina/Ballerina.toml index 9acd016..ddc699f 100644 --- a/ballerina/Ballerina.toml +++ b/ballerina/Ballerina.toml @@ -1,7 +1,7 @@ [package] org = "ballerina" name = "soap" -version = "2.0.0" +version = "2.0.1" authors = ["Ballerina"] export=["soap", "soap.soap11", "soap.soap12"] keywords = ["soap"] @@ -19,8 +19,8 @@ graalvmCompatible = true [[platform.java17.dependency]] groupId = "io.ballerina.stdlib" artifactId = "soap-native" -version = "2.0.0" -path = "../native/build/libs/soap-native-2.0.0.jar" +version = "2.0.1" +path = "../native/build/libs/soap-native-2.0.1-SNAPSHOT.jar" [[platform.java17.dependency]] groupId = "org.apache.wss4j" diff --git a/ballerina/Dependencies.toml b/ballerina/Dependencies.toml index 127be5b..22c0774 100644 --- a/ballerina/Dependencies.toml +++ b/ballerina/Dependencies.toml @@ -64,7 +64,7 @@ dependencies = [ [[package]] org = "ballerina" name = "http" -version = "2.12.0" +version = "2.12.1" dependencies = [ {org = "ballerina", name = "auth"}, {org = "ballerina", name = "cache"}, @@ -227,7 +227,7 @@ dependencies = [ [[package]] org = "ballerina" name = "mime" -version = "2.10.0" +version = "2.10.1" dependencies = [ {org = "ballerina", name = "io"}, {org = "ballerina", name = "jballerina.java"}, @@ -271,7 +271,7 @@ dependencies = [ [[package]] org = "ballerina" name = "soap" -version = "2.0.0" +version = "2.0.1" dependencies = [ {org = "ballerina", name = "crypto"}, {org = "ballerina", name = "http"}, diff --git a/ballerina/modules/soap11/tests/soap11_client_test.bal b/ballerina/modules/soap11/tests/soap11_client_test.bal index 21d5271..705ab6c 100644 --- a/ballerina/modules/soap11/tests/soap11_client_test.bal +++ b/ballerina/modules/soap11/tests/soap11_client_test.bal @@ -387,7 +387,7 @@ function testSoapReceiveWithAsymmetricBindingAndInboundConfig() returns error? { xmlns "http://schemas.xmlsoap.org/soap/envelope/" as soap11; Client soapClient = check new ("http://localhost:9090", { - outboundSecurity: { + outboundSecurity: [{ signatureConfig: { keystore: { path: KEY_STORE_PATH_2, @@ -408,6 +408,9 @@ function testSoapReceiveWithAsymmetricBindingAndInboundConfig() returns error? { encryptionAlgorithm: wssec:AES_128 } }, + { + timeToLive: 1 + }], inboundSecurity: { decryptKeystore: { path: KEY_STORE_PATH_2, diff --git a/ballerina/modules/soap12/tests/soap12_client_test.bal b/ballerina/modules/soap12/tests/soap12_client_test.bal index ef9eba9..2c8dbe6 100644 --- a/ballerina/modules/soap12/tests/soap12_client_test.bal +++ b/ballerina/modules/soap12/tests/soap12_client_test.bal @@ -414,13 +414,13 @@ function testSoapEndpoint() returns error? { } @test:Config { - groups: ["soap12", "send_receive", "new2"] + groups: ["soap12", "send_receive"] } function testSoapReceiveWithAsymmetricBindingAndInboundConfig() returns error? { - xmlns "http://www.w3.org/2003/05/soap-envelope" as soap11; + xmlns "http://www.w3.org/2003/05/soap-envelope" as soap12; Client soapClient = check new ("http://localhost:9091", { - outboundSecurity: { + outboundSecurity: [{ signatureConfig: { keystore: { path: KEY_STORE_PATH_2, @@ -440,7 +440,58 @@ function testSoapReceiveWithAsymmetricBindingAndInboundConfig() returns error? { publicKeyAlias: ALIAS, encryptionAlgorithm: wssec:AES_128 } - }, + }], + inboundSecurity: { + decryptKeystore: { + path: KEY_STORE_PATH_2, + password: PASSWORD + }, + signatureKeystore: { + path: KEY_STORE_PATH_2, + password: PASSWORD + } + } + } + ); + xml body = xml `23`; + xml response = check soapClient->sendReceive(body, "http://tempuri.org/Add"); + test:assertEquals((response/).toString(), (body/).toString()); +} + +@test:Config { + groups: ["soap12", "send_receive"] +} +function testSoapReceiveWithArrayOfOutboundConfigAndInboundConfig() returns error? { + xmlns "http://www.w3.org/2003/05/soap-envelope" as soap12; + Client soapClient = check new ("http://localhost:9091", + { + outboundSecurity: [{ + signatureConfig: { + keystore: { + path: KEY_STORE_PATH_2, + password: PASSWORD + }, + privateKeyAlias: ALIAS, + privateKeyPassword: PASSWORD, + signatureAlgorithm: soap:RSA_SHA512, + canonicalizationAlgorithm: soap:C14N_EXCL_OMIT_COMMENTS, + digestAlgorithm: soap:SHA512 + }, + encryptionConfig: { + keystore: { + path: KEY_STORE_PATH_2, + password: PASSWORD + }, + publicKeyAlias: ALIAS, + encryptionAlgorithm: wssec:AES_128 + } + }, { + timeToLive: 1 + }, { + username: "user", + password: "password", + passwordType: wssec:TEXT + }], inboundSecurity: { decryptKeystore: { path: KEY_STORE_PATH_2, @@ -455,5 +506,11 @@ function testSoapReceiveWithAsymmetricBindingAndInboundConfig() returns error? { ); xml body = xml `23`; xml response = check soapClient->sendReceive(body, "http://tempuri.org/Add"); - test:assertEquals((response/).toString(), (body/).toString()); + string:RegExp usernameTokenTag = re `.*`; + string:RegExp usernameTag = re `user`; + test:assertTrue(response.toString().includesMatch(usernameTokenTag)); + test:assertTrue(response.toString().includesMatch(usernameTag)); + string:RegExp passwordTag = re `password`; + test:assertTrue(response.toString().includesMatch(passwordTag)); + test:assertEquals((response/).toString(), (body/).toString()); } diff --git a/ballerina/soap_utils.bal b/ballerina/soap_utils.bal index e78497f..65fcfb7 100644 --- a/ballerina/soap_utils.bal +++ b/ballerina/soap_utils.bal @@ -58,7 +58,7 @@ public isolated function applySecurityPolicies(wssec:OutboundSecurityConfig|wsse } else { xml securedEnvelope = envelope.clone(); foreach wssec:OutboundSecurityConfig policy in security { - securedEnvelope = check applySecurityPolicies(policy, securedEnvelope); + securedEnvelope = check applySecurityPolicies(policy, securedEnvelope, soap12); } return securedEnvelope; }