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


##########
guacamole/src/main/java/org/apache/guacamole/tunnel/StandardTokenMap.java:
##########
@@ -102,6 +115,13 @@ public StandardTokenMap(AuthenticatedUser 
authenticatedUser) {
         else
             put(USERNAME_TOKEN, authenticatedUser.getIdentifier());
 
+        if (get(USERNAME_TOKEN).contains("\\")) {
+            put(USERNAME_DOMAIN_TOKEN, get(USERNAME_TOKEN).split("\\\\")[0]);
+            put(USERNAME_ID_TOKEN, get(USERNAME_TOKEN).split("\\\\")[1]);
+        } else {
+            put(USERNAME_DOMAIN_TOKEN, "");
+            put(USERNAME_ID_TOKEN, get(USERNAME_TOKEN));
+        }

Review Comment:
   I don't think decisions should be made about the format of the username at 
the web application level, nor that we should make specific assumptions about 
the format here when the LDAP handling of username format is so flexible.
   
   What about exposing `authenticatedUser.getIdentifier()` as something like 
`GUAC_IDENTIFIER`? That would allow the unique identifier that the LDAP support 
is already parsing out of the username to be exposed automatically without 
forcing the webapp to be aware of LDAP-specific details.
   
   If it is also necessary to pull the domain of a user authenticating with 
LDAP and make that available with a token, it would make sense to do that 
within the LDAP support, and it may be possible to extend the way 
`match-usernames` works to provide that.



-- 
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: dev-unsubscr...@guacamole.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to