necouchman commented on code in PR #931:
URL: https://github.com/apache/guacamole-client/pull/931#discussion_r1483790438
##########
extensions/guacamole-auth-ldap/src/main/java/org/apache/guacamole/auth/ldap/AuthenticationProviderService.java:
##########
@@ -356,6 +381,11 @@ private Map<String, String>
getAttributeTokens(ConnectedLDAPConfiguration config
tokens.put(TokenName.canonicalize(attr.getId(),
LDAP_ATTRIBUTE_TOKEN_PREFIX), attr.getString());
}
+ String domainName = getDomainToken(credentials);
+ if (domainName != null) {
+ String tokenName = TokenName.canonicalize("domain_name",
LDAP_ATTRIBUTE_TOKEN_PREFIX);
Review Comment:
`domain_name` should probably get a constant.
##########
extensions/guacamole-auth-ldap/src/main/java/org/apache/guacamole/auth/ldap/AuthenticationProviderService.java:
##########
@@ -306,17 +306,42 @@ public LDAPAuthenticatedUser authenticateUser(Credentials
credentials)
}
}
+ /**
+ * Returns parameter current ldap domain token generated from user
credentials
+ * If no multiple LDAP are configured on GUACAMOLE_HOME such
ldap-servers.yaml,
+ * a null is returned.
+ *
+ * @param credentials
+ * The credentials to use for authentication.
+ *
+ * @return
+ * Domain name by splitting logged username(domain/username) when
multiple LDAP configuration is available
+ * or null if no such configuration
+ */
+ private String getDomainToken(Credentials credentials) {
+ String ldapDomainName = null;
+ if (credentials.getUsername().contains("\\")) {
+ ldapDomainName = credentials.getUsername().split("\\\\")[0];
+ } else if (credentials.getUsername().contains("@")) {
Review Comment:
Please follow established style guidelines - in particular, don't "cuddle"
the tags.
--
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]