Skip to content

Commit

Permalink
Allow setting TLS SSLContext programmatically
Browse files Browse the repository at this point in the history
This change allows setting TLS SSLContext directly when wanting to configure the SSLContext programmatically
  • Loading branch information
cfredri4 committed Jun 20, 2024
1 parent 9790cb2 commit f438bb0
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/org/jgroups/util/TLS.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ public class TLS implements Lifecycle {
@Property(description="The type of the truststore")
protected String truststore_type="pkcs12";

protected SSLContext ssl_context;

@Property(description="Defines whether client certificate authentication is required. " +
"Legal values are NONE, WANT or NEED")
protected TLSClientAuth client_auth=TLSClientAuth.NONE;
Expand Down Expand Up @@ -98,6 +100,9 @@ public class TLS implements Lifecycle {
public String getTruststoreType() {return truststore_type;}
public TLS setTruststoreType(String t) {this.truststore_type=t; return this;}

public SSLContext getSSLContext() {return ssl_context;}
public TLS setSSLContext(SSLContext c) {this.ssl_context=c; return this;}

public TLSClientAuth getClientAuth() {return client_auth;}
public TLS setClientAuth(TLSClientAuth c) {this.client_auth=c; return this;}

Expand Down Expand Up @@ -137,6 +142,8 @@ public SSLContext createContext() {
}

public SocketFactory createSocketFactory() {
if (ssl_context != null)
return createSocketFactory(ssl_context);
SSLContext context=createContext();
return createSocketFactory(context);
}
Expand Down

0 comments on commit f438bb0

Please sign in to comment.