mike-jumper commented on code in PR #753:
URL: https://github.com/apache/guacamole-client/pull/753#discussion_r954380913


##########
extensions/guacamole-vault/modules/guacamole-vault-ksm/src/main/java/org/apache/guacamole/vault/ksm/secret/KsmClient.java:
##########
@@ -250,13 +290,26 @@ private void validateCache() throws GuacamoleException {
                 String hostname = recordService.getHostname(record);
                 addRecordForHost(record, hostname);
 
-                // Store based on username ONLY if no hostname (will otherwise
+                // ... and domain
+                String domain = recordService.getDomain(record);
+                addRecordForDomain(record, domain);
+
+                // Get the username off of the record
+                String username = recordService.getUsername(record);
+
+                // If domain matching is not enabled for user records,
+                // explicitly set all domains to null to allow matching
+                // on username only
+                if (!confService.getMatchUserRecordsByDomain())
+                    domain = null;

Review Comment:
   Very true, but I don't mean at creation time. I was thinking something like:
   
   ```java
   final boolean matchUserRecordsByDomain = 
confService.getMatchUserRecordsByDomain();
   records.forEach(record -> {
       ...
   });
   ```
   
   The config would then be refreshed each time the cache is refreshed, rather 
than once per record. But:
   
   > Well, that's not the only config parsing that's going on now - 
`getUsername` and `getDomain` now also parse the config every time they're 
called ...
   
   That's a really good point. It sounds like the minor performance hit and 
loss of nifty lambda isn't worth the added complexity.



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