diff --git a/extensions/guacamole-auth-ldap/src/main/java/org/apache/guacamole/auth/ldap/ObjectQueryService.java b/extensions/guacamole-auth-ldap/src/main/java/org/apache/guacamole/auth/ldap/ObjectQueryService.java index 7507948fa..80b96fe2f 100644 --- a/extensions/guacamole-auth-ldap/src/main/java/org/apache/guacamole/auth/ldap/ObjectQueryService.java +++ b/extensions/guacamole-auth-ldap/src/main/java/org/apache/guacamole/auth/ldap/ObjectQueryService.java @@ -199,8 +199,8 @@ public class ObjectQueryService { * limiting the maximum depth to which referrals can go. * * @param relevantAttributes - * The attribute(s) relevant to return for this search, - * if all available should be returned pass null as value. + * The attribute(s) relevant to return for this search, or null if all + * available attributes should be returned. * * @return * A list of all results accessible to the user currently bound under @@ -230,9 +230,9 @@ public class ObjectQueryService { // Search within subtree of given base DN SearchRequest request = ldapService.getSearchRequest(baseDN, query); - if (relevantAttributes != null) { + + if (relevantAttributes != null) request.addAttributes(relevantAttributes.toArray(new String[0])); - } // Produce list of all entries in the search result, automatically // following referrals if configured to do so diff --git a/extensions/guacamole-auth-ldap/src/main/java/org/apache/guacamole/auth/ldap/group/UserGroupService.java b/extensions/guacamole-auth-ldap/src/main/java/org/apache/guacamole/auth/ldap/group/UserGroupService.java index af1281a4e..7c54c72d6 100644 --- a/extensions/guacamole-auth-ldap/src/main/java/org/apache/guacamole/auth/ldap/group/UserGroupService.java +++ b/extensions/guacamole-auth-ldap/src/main/java/org/apache/guacamole/auth/ldap/group/UserGroupService.java @@ -18,8 +18,8 @@ */ package org.apache.guacamole.auth.ldap.group; + import com.google.inject.Inject; -import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.HashSet; @@ -192,7 +192,8 @@ public class UserGroupService { ldapConnection, userDN, confService.getUserSearchFilter(), - 0, null); + 0, + null); // ... there can surely only be one if (userEntries.size() != 1) logger.warn("user DN \"{}\" does not return unique value " @@ -215,15 +216,11 @@ public class UserGroupService { } // Gather all attributes relevant for a group - ArrayList groupAttributes = new ArrayList(); + List groupAttributes = confService.getGroupNameAttributes(); groupAttributes.add(confService.getMemberAttribute()); - confService.getGroupNameAttributes().forEach( - attribute -> groupAttributes.add(attribute) - ); // Get all groups the user is a member of starting at the groupBaseDN, // excluding guacConfigGroups - return queryService.search( ldapConnection, groupBaseDN,