Documentation updates for Active Directory Realm. Also replaces empty string arrays with Strings.EMPTY_ARRAY

Original commit: elastic/x-pack-elasticsearch@3f02d89a20
This commit is contained in:
c-a-m 2014-11-20 12:39:46 -07:00
parent 350665bb26
commit 8397112422
2 changed files with 4 additions and 3 deletions

View File

@ -80,7 +80,7 @@ public class ActiveDirectoryConnectionFactory extends AbstractComponent implemen
DirContext ctx = new InitialDirContext(ldapEnv);
SearchControls searchCtls = new SearchControls();
searchCtls.setSearchScope(SearchControls.SUBTREE_SCOPE);
searchCtls.setReturningAttributes( new String[] {} );
searchCtls.setReturningAttributes( Strings.EMPTY_ARRAY );
String searchFilter = "(&(objectClass=user)(userPrincipalName={0}))";
NamingEnumeration<SearchResult> results = ctx.search(userSearchDN, searchFilter, new Object[]{ userPrincipal }, searchCtls);

View File

@ -5,6 +5,7 @@
*/
package org.elasticsearch.shield.authc.ldap;
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.logging.ESLogger;
import org.elasticsearch.common.logging.ESLoggerFactory;
import org.elasticsearch.shield.authc.support.ldap.AbstractLdapConnection;
@ -67,7 +68,7 @@ public class LdapConnection extends AbstractLdapConnection {
public List<String> getGroupsFromSearch(String userDn){
List<String> groups = new LinkedList<>();
SearchControls search = new SearchControls();
search.setReturningAttributes( new String[0] );
search.setReturningAttributes( Strings.EMPTY_ARRAY );
search.setSearchScope( this.isGroupSubTreeSearch ? SearchControls.SUBTREE_SCOPE : SearchControls.ONELEVEL_SCOPE);
//This could be made could be made configurable but it should cover all cases
@ -77,7 +78,7 @@ public class LdapConnection extends AbstractLdapConnection {
try {
NamingEnumeration<SearchResult> results = jndiContext.search(
groupSearchDN, filter, new Object[]{ userDn }, search);
groupSearchDN, filter, new Object[]{userDn}, search);
while (results.hasMoreElements()){
groups.add(results.next().getNameInNamespace());
}