subbareddyalamur commented on PR #1163:
URL: 
https://github.com/apache/guacamole-client/pull/1163#issuecomment-3888458521

   Thank you for the review. I've refactored the approach based on your 
feedback.
   
   Instead of manually building tokens for each BALANCING child (which 
duplicated the logic in `addTokens(Connection)`), the code now simply delegates 
to the existing `addTokens(child, tokens)` for each child connection:
   
   ```java
   for (String childId : childIds) {
       Connection child = getPrivileged()
               .getConnectionDirectory().get(childId);
       if (child == null) continue;
       addTokens(child, tokens);
   }
   ```
   
   This eliminates the code duplication entirely — the same 
`addTokens(Connection, Map)` method used for direct connections is now reused 
for BALANCING children. Any future changes to connection token resolution (new 
token types, etc.) will automatically apply to both paths.
   
   Regarding other extensions' tokens (LDAP attributes, SSO tokens): this is a 
deeper issue in the JDBC BALANCING pipeline itself — 
`AbstractGuacamoleTunnelService.getGuacamoleTunnel(ConnectionGroup)` selects 
and connects a `ModeledConnection` directly without running it through the 
extension decoration chain, so no extension's `addTokens(Connection)` gets 
called for the selected child. The proper fix for that would be at the JDBC 
layer. This PR ensures the vault extension's own token resolution works 
correctly for BALANCING children without duplicating any code.
   
   I'll force-push the updated commit shortly.
   


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