inject PasswordEncoder into DaoAuthenticationProvider constructor
Closes gh-14691
This commit is contained in:
parent
d6ae058ee1
commit
75197ca531
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2019 the original author or authors.
|
* Copyright 2002-2024 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -67,11 +67,14 @@ class InitializeUserDetailsBeanManagerConfigurer extends GlobalAuthenticationCon
|
||||||
PasswordEncoder passwordEncoder = getBeanOrNull(PasswordEncoder.class);
|
PasswordEncoder passwordEncoder = getBeanOrNull(PasswordEncoder.class);
|
||||||
UserDetailsPasswordService passwordManager = getBeanOrNull(UserDetailsPasswordService.class);
|
UserDetailsPasswordService passwordManager = getBeanOrNull(UserDetailsPasswordService.class);
|
||||||
CompromisedPasswordChecker passwordChecker = getBeanOrNull(CompromisedPasswordChecker.class);
|
CompromisedPasswordChecker passwordChecker = getBeanOrNull(CompromisedPasswordChecker.class);
|
||||||
DaoAuthenticationProvider provider = new DaoAuthenticationProvider();
|
DaoAuthenticationProvider provider;
|
||||||
provider.setUserDetailsService(userDetailsService);
|
|
||||||
if (passwordEncoder != null) {
|
if (passwordEncoder != null) {
|
||||||
provider.setPasswordEncoder(passwordEncoder);
|
provider = new DaoAuthenticationProvider(passwordEncoder);
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
provider = new DaoAuthenticationProvider();
|
||||||
|
}
|
||||||
|
provider.setUserDetailsService(userDetailsService);
|
||||||
if (passwordManager != null) {
|
if (passwordManager != null) {
|
||||||
provider.setUserDetailsPasswordService(passwordManager);
|
provider.setUserDetailsPasswordService(passwordManager);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue