Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Redesign HTTP listener/client SecureSocket API #255

Merged
merged 8 commits into from
Mar 8, 2021

Conversation

ldclakmal
Copy link
Member

@ldclakmal ldclakmal commented Mar 5, 2021

Purpose

This PR redesign the HTTP listener/client SecureSocket API for SwanLake release. The updated API would be as follows:

Listener

public type ListenerSecureSocket record {|
   crypto:KeyStore|CertKey key;
   record {|
       VerifyClient verifyClient = REQUIRE;
       crypto:TrustStore|string cert;
   |} mutualSsl?;
   record {|
       Protocol name;
       string[] versions = [];
   |} protocol?;
   record {|
       CertValidationType type = OCSP_STAPLING;
       int cacheSize;
       decimal cacheValidityPeriod;
   |} certValidation?;
   string[] ciphers = [];
   boolean shareSession = true;
   decimal handshakeTimeout?;
   decimal sessionTimeout?;
|};
 
public type CertKey record {|
   string certFile;
   string keyFile;
   string keyPassword?;
|};
 
public enum VerifyClient {
   REQUIRE,
   OPTIONAL
}
 
public enum Protocol {
   SSL,
   TLS,
   DTLS
}
 
public enum CertValidationType {
   OCSP_CRL,
   OCSP_STAPLING
}

Client

public type ClientSecureSocket record {|
   boolean enable = true;
   crypto:TrustStore|string cert?;
   crypto:KeyStore|CertKey key?;
   record {|
       Protocol name;
       string[] versions = [];
   |} protocol?;
   record {|
       CertValidationType type = OCSP_STAPLING;
       int cacheSize;
       decimal cacheValidityPeriod;
   |} certValidation?;
   string[] ciphers?;
   boolean verifyHostName = true;
   boolean shareSession = true;
   decimal handshakeTimeout?;
   decimal sessionTimeout?;
|};
 
public type CertKey record {|
   string certFile;
   string keyFile;
   string keyPassword?;
|};
 
public enum Protocol {
   SSL,
   TLS,
   DTLS
}
 
public enum CertValidationType {
   OCSP_CRL,
   OCSP_STAPLING
}

Fixes ballerina-platform/ballerina-library#917

Related to ballerina-platform/ballerina-library#584

@ldclakmal ldclakmal marked this pull request as ready for review March 5, 2021 14:57
ldclakmal and others added 2 commits March 8, 2021 10:56
Co-authored-by: Bhashinee <Bhashinee@users.noreply.github.com>
@codecov
Copy link

codecov bot commented Mar 8, 2021

Codecov Report

Merging #255 (f9c4ab9) into master (de1672f) will decrease coverage by 13.80%.
The diff coverage is 67.95%.

Impacted file tree graph

@@              Coverage Diff              @@
##             master     #255       +/-   ##
=============================================
- Coverage     63.80%   50.00%   -13.81%     
  Complexity       62       62               
=============================================
  Files           327      377       +50     
  Lines         14552    18506     +3954     
  Branches       1655     3538     +1883     
=============================================
- Hits           9285     9253       -32     
- Misses         4511     8512     +4001     
+ Partials        756      741       -15     
Impacted Files Coverage Δ Complexity Δ
http-ballerina/http_client_endpoint.bal 0.00% <0.00%> (ø) 0.00 <0.00> (?)
http-ballerina/http_service_endpoint.bal 0.00% <0.00%> (ø) 0.00 <0.00> (?)
http-ballerina/http_types.bal 0.00% <ø> (ø) 0.00 <0.00> (?)
...allerinalang/net/http/websocket/WebSocketUtil.java 0.00% <ø> (ø) 0.00 <0.00> (ø)
...main/java/org/ballerinalang/net/http/HttpUtil.java 70.78% <67.62%> (-0.81%) 0.00 <0.00> (ø)
...java/org/ballerinalang/net/http/HttpConstants.java 100.00% <100.00%> (ø) 0.00 <0.00> (ø)
...ransport/contractimpl/common/states/StateUtil.java 68.62% <0.00%> (-11.77%) 0.00% <0.00%> (ø%)
...mpl/listener/states/http2/ReceivingEntityBody.java 55.00% <0.00%> (-5.00%) 0.00% <0.00%> (ø%)
...ansport/contractimpl/HttpOutboundRespListener.java 68.88% <0.00%> (-4.45%) 0.00% <0.00%> (ø%)
...contractimpl/listener/states/ReceivingHeaders.java 48.97% <0.00%> (-4.09%) 0.00% <0.00%> (ø%)
... and 61 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update de1672f...f9c4ab9. Read the comment docs.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update SecureSocket API of HTTP
2 participants