Merge pull request elastic/elasticsearch#2044 from PhaedrusTheGreek/group_search_noattrs
Change some LDAP searches to NOATTRS to avoid unnecessary results Original commit: elastic/x-pack-elasticsearch@60c41af5a6
This commit is contained in:
commit
8af3f91eb5
|
@ -45,7 +45,7 @@ public class ActiveDirectoryGroupsResolver implements GroupsResolver {
|
|||
Filter groupSearchFilter = buildGroupQuery(connection, userDn, timeout, logger);
|
||||
logger.debug("group SID to DN search filter: [{}]", groupSearchFilter);
|
||||
|
||||
SearchRequest searchRequest = new SearchRequest(baseDn, scope.scope(), groupSearchFilter, Strings.EMPTY_ARRAY);
|
||||
SearchRequest searchRequest = new SearchRequest(baseDn, scope.scope(), groupSearchFilter, SearchRequest.NO_ATTRIBUTES);
|
||||
searchRequest.setTimeLimitSeconds(Math.toIntExact(timeout.seconds()));
|
||||
SearchResult results;
|
||||
try {
|
||||
|
|
|
@ -89,7 +89,7 @@ public class ActiveDirectorySessionFactory extends SessionFactory {
|
|||
try {
|
||||
connection.bind(userPrincipal, new String(password.internalChars()));
|
||||
SearchRequest searchRequest = new SearchRequest(userSearchDN, userSearchScope.scope(),
|
||||
createFilter(userSearchFilter, userName), Strings.EMPTY_ARRAY);
|
||||
createFilter(userSearchFilter, userName), SearchRequest.NO_ATTRIBUTES);
|
||||
searchRequest.setTimeLimitSeconds(Math.toIntExact(timeout.seconds()));
|
||||
SearchResult results = search(connection, searchRequest, logger);
|
||||
int numResults = results.getEntryCount();
|
||||
|
|
|
@ -152,7 +152,7 @@ public class LdapUserSearchSessionFactory extends SessionFactory {
|
|||
|
||||
private String findUserDN(String user) throws Exception {
|
||||
SearchRequest request = new SearchRequest(userSearchBaseDn, scope.scope(), createEqualityFilter(userAttribute, encodeValue(user))
|
||||
, Strings.EMPTY_ARRAY);
|
||||
, SearchRequest.NO_ATTRIBUTES);
|
||||
request.setTimeLimitSeconds(Math.toIntExact(timeout.seconds()));
|
||||
LDAPConnectionPool connectionPool = connectionPool();
|
||||
SearchResultEntry entry = searchForEntry(connectionPool, request, logger);
|
||||
|
|
|
@ -58,7 +58,8 @@ class SearchGroupsResolver implements GroupsResolver {
|
|||
|
||||
String userId = userAttribute != null ? readUserAttribute(connection, userDn, timeout, logger) : userDn;
|
||||
try {
|
||||
SearchRequest searchRequest = new SearchRequest(baseDn, scope.scope(), createFilter(filter, userId), Strings.EMPTY_ARRAY);
|
||||
SearchRequest searchRequest = new SearchRequest(baseDn, scope.scope(), createFilter(filter, userId),
|
||||
SearchRequest.NO_ATTRIBUTES);
|
||||
searchRequest.setTimeLimitSeconds(Math.toIntExact(timeout.seconds()));
|
||||
SearchResult results = search(connection, searchRequest, logger);
|
||||
for (SearchResultEntry entry : results.getSearchEntries()) {
|
||||
|
|
Loading…
Reference in New Issue