Deprecate single-arg PasswordComparisonAuthenticator ctor

Add new constructor accepting PasswordEncoder to eventually
remove deprecated LdapShaPasswordEncoder usage.

Closes gh-18430

Signed-off-by: LeeJiWon <dlwldnjs1009@gmail.com>
This commit is contained in:
LeeJiWon 2026-01-24 14:54:49 +09:00 committed by Rob Winch
parent 9fa0a34b4c
commit 89467605ca
2 changed files with 15 additions and 1 deletions

View File

@ -52,14 +52,27 @@ public final class PasswordComparisonAuthenticator extends AbstractLdapAuthentic
private static final Log logger = LogFactory.getLog(PasswordComparisonAuthenticator.class);
private PasswordEncoder passwordEncoder = new LdapShaPasswordEncoder(KeyGenerators.shared(0));
private PasswordEncoder passwordEncoder;
private String passwordAttributeName = "userPassword";
private boolean usePasswordAttrCompare = false;
/**
* @deprecated Use
* {@link #PasswordComparisonAuthenticator(BaseLdapPathContextSource, PasswordEncoder)}
* instead
*/
@Deprecated(since = "7.1")
@SuppressWarnings("deprecation")
public PasswordComparisonAuthenticator(BaseLdapPathContextSource contextSource) {
this(contextSource, new LdapShaPasswordEncoder(KeyGenerators.shared(0)));
}
public PasswordComparisonAuthenticator(BaseLdapPathContextSource contextSource, PasswordEncoder passwordEncoder) {
super(contextSource);
Assert.notNull(passwordEncoder, "passwordEncoder must not be null");
this.passwordEncoder = passwordEncoder;
}
@Override

View File

@ -35,6 +35,7 @@ import static org.mockito.Mockito.mock;
/**
* @author Luke Taylor
*/
@SuppressWarnings("deprecation")
public class PasswordComparisonAuthenticatorMockTests {
@Test