Сводка
Использование BindAuthenticator
для проверки подлинности по LDAP, хорошо работает с правильными учетными данными, но с неверным паролем, оно останавливается вместо сбоя и приводит к возникновению исключения тайм-аута.
ActualПоведение
Как объяснено выше.
Ожидаемое поведение
Сбой BindAuthenticator
немедленно, если пароль неправильный.
Конфигурация
См. Образец ниже.
Версия
Spring Security 5.2.0.RELEASE
Образец
var contextSource = new LdapContextSource();
contextSource.setUrls(urls);
contextSource.afterPropertiesSet();
var authenticator = new BindAuthenticator(contextSource);
authenticator.setUserSearch(new FilterBasedLdapUserSearch(base, filter, contextSource));
authenticator.afterPropertiesSet();
var correct = new UsernamePasswordAuthenticationToken(username, "correct");
authenticator.authenticate(correct); // <- it succeeds immediately
var wrong = new UsernamePasswordAuthenticationToken(username, "wrong");
authenticator.authenticate(wrong); // <- it stalls and timeouts