Skip to content

Commit

Permalink
Merge pull request #124 from Nuvindu/master
Browse files Browse the repository at this point in the history
Set security configuration types to public
  • Loading branch information
Nuvindu authored Apr 25, 2024
2 parents 0231d12 + a619e2d commit 1cf2c9b
Show file tree
Hide file tree
Showing 11 changed files with 28 additions and 53 deletions.
2 changes: 1 addition & 1 deletion ballerina/Dependencies.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

[ballerina]
dependencies-toml-version = "2"
distribution-version = "2201.9.0-20240410-095500-2653a74d"
distribution-version = "2201.9.0-20240419-152500-bd530dd2"

[[package]]
org = "ballerina"
Expand Down
9 changes: 0 additions & 9 deletions ballerina/Module.md
Original file line number Diff line number Diff line change
Expand Up @@ -206,12 +206,3 @@ public function main() returns error? {
xml response = check soapClient->sendReceive(envelope, "http://tempuri.org/Add");
}
```

## Report issues

To report bugs, request new features, start new discussions, view project boards, etc., go to the [Ballerina standard library parent repository](https://github.com/ballerina-platform/ballerina-standard-library).

## Useful links

- Chat live with us via our [Discord server](https://discord.gg/ballerinalang).
- Post all technical questions on Stack Overflow with the [#ballerina](https://stackoverflow.com/questions/tagged/ballerina) tag.
9 changes: 0 additions & 9 deletions ballerina/Package.md
Original file line number Diff line number Diff line change
Expand Up @@ -197,12 +197,3 @@ public function main() returns error? {
});
}
```

## Report issues

To report bugs, request new features, start new discussions, view project boards, etc., go to the [Ballerina standard library parent repository](https://github.com/ballerina-platform/ballerina-standard-library).

## Useful links

- Chat live with us via our [Discord server](https://discord.gg/ballerinalang).
- Post all technical questions on Stack Overflow with the [#ballerina](https://stackoverflow.com/questions/tagged/ballerina) tag.
6 changes: 2 additions & 4 deletions ballerina/configs.bal
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
// specific language governing permissions and limitations
// under the License.

import soap.wssec;

import ballerina/http;

# SOAP client configurations.
Expand All @@ -25,6 +23,6 @@ import ballerina/http;
# + outboundSecurity - Web service security configurations to decrypt and verify SOAP responses
public type ClientConfig record {|
http:ClientConfiguration httpConfig = {};
wssec:InboundSecurityConfig|wssec:InboundSecurityConfig[] inboundSecurity = NO_POLICY;
wssec:OutboundSecurityConfig outboundSecurity = {};
InboundSecurityConfig|InboundSecurityConfig[] inboundSecurity = NO_POLICY;
OutboundSecurityConfig outboundSecurity = {};
|};
9 changes: 0 additions & 9 deletions ballerina/modules/soap11/Module.md
Original file line number Diff line number Diff line change
Expand Up @@ -156,12 +156,3 @@ public function main() returns error? {
});
}
```

## Report issues

To report bugs, request new features, start new discussions, view project boards, etc., go to the [Ballerina standard library parent repository](https://github.com/ballerina-platform/ballerina-standard-library).

## Useful links

- Chat live with us via our [Discord server](https://discord.gg/ballerinalang).
- Post all technical questions on Stack Overflow with the [#ballerina](https://stackoverflow.com/questions/tagged/ballerina) tag.
9 changes: 4 additions & 5 deletions ballerina/modules/soap11/soap11.bal
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
// under the License.

import soap;
import soap.wssec;

import ballerina/http;
import ballerina/mime;
Expand All @@ -24,8 +23,8 @@ import ballerina/jballerina.java;
# Object for the basic SOAP 1.1 client endpoint.
public isolated client class Client {
private final http:Client soapClient;
private final readonly & wssec:InboundSecurityConfig|wssec:InboundSecurityConfig[] inboundSecurity;
private final readonly & wssec:OutboundSecurityConfig outboundSecurity;
private final readonly & soap:InboundSecurityConfig|soap:InboundSecurityConfig[] inboundSecurity;
private final readonly & soap:OutboundSecurityConfig outboundSecurity;

# Gets invoked during object initialization.
#
Expand Down Expand Up @@ -82,9 +81,9 @@ public isolated client class Client {
response = check soap:sendReceive(securedBody, self.soapClient, action, headers, path, false);
}
lock {
wssec:OutboundSecurityConfig? outboundSecurity = self.outboundSecurity.clone();
soap:OutboundSecurityConfig? outboundSecurity = self.outboundSecurity.clone();
do {
if outboundSecurity is wssec:OutboundSecurityConfig && outboundSecurity != {} {
if outboundSecurity is soap:OutboundSecurityConfig && outboundSecurity != {} {
if response is xml {
return check soap:applyOutboundConfig(outboundSecurity.clone(), response.clone(), false);
} else {
Expand Down
9 changes: 0 additions & 9 deletions ballerina/modules/soap12/Module.md
Original file line number Diff line number Diff line change
Expand Up @@ -156,12 +156,3 @@ public function main() returns error? {
});
}
```

## Report issues

To report bugs, request new features, start new discussions, view project boards, etc., go to the [Ballerina standard library parent repository](https://github.com/ballerina-platform/ballerina-standard-library).

## Useful links

- Chat live with us via our [Discord server](https://discord.gg/ballerinalang).
- Post all technical questions on Stack Overflow with the [#ballerina](https://stackoverflow.com/questions/tagged/ballerina) tag.
9 changes: 4 additions & 5 deletions ballerina/modules/soap12/soap12.bal
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
// under the License.

import soap;
import soap.wssec;

import ballerina/http;
import ballerina/mime;
Expand All @@ -24,8 +23,8 @@ import ballerina/jballerina.java;
# Object for the basic SOAP 1.2 client endpoint.
public isolated client class Client {
private final http:Client soapClient;
private final readonly & wssec:InboundSecurityConfig|wssec:InboundSecurityConfig[] inboundSecurity;
private final readonly & wssec:OutboundSecurityConfig outboundSecurity;
private final readonly & soap:InboundSecurityConfig|soap:InboundSecurityConfig[] inboundSecurity;
private final readonly & soap:OutboundSecurityConfig outboundSecurity;

# Gets invoked during object initialization.
#
Expand Down Expand Up @@ -82,9 +81,9 @@ public isolated client class Client {
response = check soap:sendReceive(securedBody, self.soapClient, action, headers, path);
}
lock {
wssec:OutboundSecurityConfig? outboundSecurity = self.outboundSecurity.clone();
soap:OutboundSecurityConfig? outboundSecurity = self.outboundSecurity.clone();
do {
if outboundSecurity is wssec:OutboundSecurityConfig && outboundSecurity != {} {
if outboundSecurity is soap:OutboundSecurityConfig && outboundSecurity != {} {
if response is xml {
return check soap:applyOutboundConfig(outboundSecurity.clone(), response.clone());
} else {
Expand Down
2 changes: 1 addition & 1 deletion ballerina/soap_utils.bal
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public isolated function applySecurityPolicies(wssec:InboundSecurityConfig|wssec
}
}

public isolated function applyOutboundConfig(wssec:OutboundSecurityConfig outboundSecurity, xml envelope,
public isolated function applyOutboundConfig(OutboundSecurityConfig outboundSecurity, xml envelope,
boolean soap12 = true) returns xml|Error {
xmlns "http://schemas.xmlsoap.org/soap/envelope/" as soap11;
xmlns "http://www.w3.org/2003/05/soap-envelope" as soap12;
Expand Down
15 changes: 15 additions & 0 deletions ballerina/types.bal
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
// specific language governing permissions and limitations
// under the License.

import soap.wssec;

# Represents enums for all the supported password types.
#
public enum PasswordType {
Expand All @@ -37,3 +39,16 @@ public enum SignatureAlgorithm {
public enum EncryptionAlgorithm {
RSA_ECB = "http://www.w3.org/2001/04/xmlenc#rsa-1_5"
}

# Represents the record for outbound security configurations to verify and decrypt SOAP envelopes.
#
# + verificationKey - The public key to verify the signature of the SOAP envelope
# + decryptionKey - The private key to decrypt the SOAP envelope
# + signatureAlgorithm - The algorithm to verify the SOAP envelope
# + decryptionAlgorithm - The algorithm to decrypt the SOAP body
public type OutboundSecurityConfig record {
*wssec:OutboundSecurityConfig;
};

# Union type of all the inbound web service security configurations.
public type InboundSecurityConfig wssec:InboundSecurityConfig;
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
org.gradle.caching=true
group=io.ballerina.stdlib
version=0.11.0-SNAPSHOT
version=1.0.0-SNAPSHOT

checkstylePluginVersion=10.12.0
spotbugsPluginVersion=5.0.14
Expand Down

0 comments on commit 1cf2c9b

Please sign in to comment.