gnodet-bot commented on code in PR #31305:
URL: https://github.com/apache/camel/pull/31305#discussion_r4781256702


##########
components/camel-infinispan/camel-infinispan/src/main/java/org/apache/camel/component/infinispan/remote/InfinispanRemoteAggregationRepository.java:
##########
@@ -110,6 +112,41 @@ protected void doStart() throws Exception {
         ServiceHelper.startService(manager);
     }
 
+    private void applyConnectionProperties(InfinispanRemoteConfiguration conf, 
ConfigurationBuilder builder)
+            throws Exception {
+        if (ObjectHelper.isNotEmpty(conf.getHosts())) {
+            builder.addServers(conf.getHosts());
+        }
+        if (conf.isSecure()) {
+            if (ObjectHelper.isNotEmpty(conf.getUsername()) && 
ObjectHelper.isNotEmpty(conf.getPassword())) {
+                builder.security().authentication()
+                        .username(conf.getUsername())
+                        .password(conf.getPassword());
+            }

Review Comment:
   💡 **Low:** `applyConnectionProperties` silently skips credentials when 
`secure=true` but username/password are empty, while 
`InfinispanRemoteManager.doStart()` throws `IllegalArgumentException("If the 
Infinispan instance is secured, username and password are needed")`. A 
misconfigured `AggregationRepository` will fail at Infinispan connection time 
with an opaque error instead of a clear startup exception. Consider adding the 
same guard:
   
   ```suggestion
               if (ObjectHelper.isNotEmpty(conf.getUsername()) && 
ObjectHelper.isNotEmpty(conf.getPassword())) {
                   builder.security().authentication()
                           .username(conf.getUsername())
                           .password(conf.getPassword());
               } else {
                   throw new IllegalArgumentException(
                           "If the Infinispan instance is secured, username and 
password are needed");
               }
   ```



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