Skip to content

Commit

Permalink
8275535: Retrying a failed authentication on multiple LDAP servers ca…
Browse files Browse the repository at this point in the history
…n lead to users blocked

Reviewed-by: aefimov, dfuchs
  • Loading branch information
martinuy committed May 12, 2022
1 parent cc7560e commit 3be394e
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,10 @@ private static DirContext getUsingURL(String url, Hashtable<?,?> env)
ctx = getLdapCtxFromUrl(
r.getDomainName(), url, new LdapURL(u), env);
return ctx;
} catch (AuthenticationException e) {
// do not retry on a different endpoint to avoid blocking
// the user if authentication credentials are wrong.
throw e;
} catch (NamingException e) {
// try the next element
lastException = e;
Expand Down Expand Up @@ -241,6 +245,10 @@ private static DirContext getUsingURLs(String[] urls, Hashtable<?,?> env)
for (String u : urls) {
try {
return getUsingURL(u, env);
} catch (AuthenticationException e) {
// do not retry on a different URL to avoid blocking
// the user if authentication credentials are wrong.
throw e;
} catch (NamingException e) {
ex = e;
}
Expand Down

0 comments on commit 3be394e

Please sign in to comment.