Skip to content

Commit

Permalink
[FIXED JENKINS-11720] BadCredentialsException thrown from the doCheck…
Browse files Browse the repository at this point in the history
…Name method initiates the authentication, but this makes no sense for form validation check.
  • Loading branch information
kohsuke committed Nov 30, 2011
1 parent fcf9cd9 commit 7021070
Showing 1 changed file with 3 additions and 0 deletions.
Expand Up @@ -56,18 +56,21 @@ public ActiveDirectoryUnixAuthenticationProvider(ActiveDirectorySecurityRealm re

protected UserDetails retrieveUser(String username, UsernamePasswordAuthenticationToken authentication) throws AuthenticationException {
UserDetails userDetails = null;
BadCredentialsException e = null;
for (String domainName : domainNames) {
try {
userDetails = retrieveUser(username, authentication, domainName);
} catch (BadCredentialsException bce) {
LOGGER.log(Level.WARNING, "Credential exception tying to authenticate against "+domainName+" domain", bce);
e = bce;
}
if (userDetails!=null) {
break;
}
}
if (userDetails==null) {
LOGGER.log(Level.WARNING, "Exhausted all configured domains and could not authenticate against any.");
if (e!=null) throw e;
throw new BadCredentialsException("Either no such user '"+username+"' or incorrect password");
}
return userDetails;
Expand Down

0 comments on commit 7021070

Please sign in to comment.