burmanm commented on code in PR #318:
URL: https://github.com/apache/cassandra-sidecar/pull/318#discussion_r2803481310


##########
server/src/main/java/org/apache/cassandra/sidecar/modules/ConfigurationModule.java:
##########
@@ -121,11 +129,41 @@ CQLSessionProvider cqlSessionProvider(Vertx vertx,
     {
         CQLSessionProviderImpl cqlSessionProvider = new 
CQLSessionProviderImpl(sidecarConfiguration,
                                                                                
NettyOptions.DEFAULT_INSTANCE,
+                                                                               
cqlAuthProvider(sidecarConfiguration),
                                                                                
driverUtils);
         vertx.eventBus().localConsumer(ON_SERVER_STOP.address(), message -> 
cqlSessionProvider.close());
         return cqlSessionProvider;
     }
 
+    CqlAuthProvider cqlAuthProvider(SidecarConfiguration sidecarConfiguration)
+    {
+        DriverConfiguration driverConfiguration = 
sidecarConfiguration.driverConfiguration();
+
+        ParameterizedClassConfiguration config = 
driverConfiguration.authProvider();
+        if (config == null)
+        {
+            // Fallback to the old one
+            return new ConfigProvider(
+                Map.of("username", driverConfiguration.username(), "password", 
driverConfiguration.password()));
+        }
+
+        Map<String, String> namedParameters = config.namedParameters();

Review Comment:
   This looks hacky because it is. Originally I had here:
   
   ```java
   if (config.namedParameters() == null)
   {
       throw new ConfigurationException(...)
   }
   ```
   
   But the findbugs wasn't accepting that, claiming the later access to 
namedParameters would potentially cause NPE in the next lines in this function. 
So to please the findbugs, I'm creating an empty namedParameters here and 
letting the providers throw the ConfigurationException.



-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to