Octavi00 commented on code in PR #14934:
URL: https://github.com/apache/gravitino/pull/14934#discussion_r4547148736


##########
clients/client-java/src/main/java/org/apache/gravitino/client/TLSConfigurers.java:
##########
@@ -98,44 +220,58 @@ public Builder storeType(String storeType) {
      * Builds a {@link TLSConfigurer} using the configured truststore and 
optional client keystore.
      *
      * @return the configured TLS configurer
-     * @throws IllegalArgumentException if required configuration is missing 
or the stores cannot be
-     *     loaded
+     * @throws IllegalArgumentException if the TLS configuration is invalid, 
unsupported, or cannot
+     *     be initialized
      */
     public TLSConfigurer build() {
-      Preconditions.checkArgument(trustStorePath != null, "Truststore path 
must be provided");
-      Preconditions.checkArgument(
-          trustStorePassword != null, "Truststore password must be provided");
-      Preconditions.checkArgument(storeType != null, "Store type must be 
provided");
-      Preconditions.checkArgument(
-          keyStorePath == null || keyStorePassword != null,
-          "Keystore password must be provided when a keystore is configured");
-
       SSLContext sslContext = buildSslContext();
 
+      validateTlsSettings(sslContext);
+
+      String[] configuredProtocols = protocols.clone();
+      String[] configuredCipherSuites = cipherSuites.clone();
+
       return new TLSConfigurer() {
         @Override
         public SSLContext sslContext() {
           return sslContext;
         }
+
+        @Override
+        public String[] supportedProtocols() {
+          return configuredProtocols.clone();
+        }
+
+        @Override
+        public String[] supportedCipherSuites() {
+          return configuredCipherSuites.clone();
+        }
       };
     }
 
     /**
-     * Creates an SSL context from the configured truststore and optional 
client keystore.
+     * Creates an SSL context from the configured or default truststore and 
optional client
+     * keystore.
      *
      * @return the configured SSL context
      * @throws IllegalArgumentException if the SSL context cannot be created
      */
     private SSLContext buildSslContext() {
       try {
-        KeyStore trustStore = loadStore(trustStorePath, trustStorePassword, 
"truststore");
-
         TrustManagerFactory trustManagerFactory =
             
TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
-        trustManagerFactory.init(trustStore);
+
+        // Use the configured truststore, or fall back to the default JVM 
truststore.
+        if (trustStorePath != null) {

Review Comment:
   Yes that is intentional and is covered in the how to use gravitino 
documentation with the line
   
   For HTTPS connections using the default JVM truststore without client 
certificate authentication, no additional TLS configuration is required.
   
   Having a keystore is what changes a TLS connection into a mTLS connection 
where the handshake/verification is expected to go both ways.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to