Skip to content

Commit

Permalink
Merge pull request #29 from fbelzunc/JENKINS-34143
Browse files Browse the repository at this point in the history
[FIXED JENKINS-34143] Test Active Directory connection button reports success if the search operation doesn't have any result
  • Loading branch information
fbelzunc committed Apr 12, 2016
2 parents 313942c + a9be808 commit 8a86022
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
Expand Up @@ -389,7 +389,10 @@ public FormValidation doValidate(@QueryParameter(fixEmpty = true) String domain,
DirContext context = bind(bindName, Secret.toString(password), servers);
try {
// actually do a search to make sure the credential is valid
new LDAPSearchBuilder(context, toDC(name)).searchOne("(objectClass=user)");
Attributes userAttributes = new LDAPSearchBuilder(context, toDC(name)).searchOne("(objectClass=user)");
if (userAttributes == null) {
return FormValidation.error(Messages.ActiveDirectorySecurityRealm_NoUsers());
}
} finally {
context.close();
}
Expand Down
Expand Up @@ -3,3 +3,5 @@ DisplayName=Active Directory
GroupLookupStrategy.Auto=Automatic
GroupLookupStrategy.Recursive=Recursive group queries
GroupLookupStrategy.ChainMatch=LDAP_MATCHING_RULE_IN_CHAIN

ActiveDirectorySecurityRealm.NoUsers=The bind with the managerDn was successful but AD was not able to find any user.

0 comments on commit 8a86022

Please sign in to comment.