mirror of
https://github.com/spring-projects/spring-security.git
synced 2025-06-13 15:42:25 +00:00
Include UsernameNotFoundException in BadCredentialsException
Closes gh-16496 Signed-off-by: dae won <eodnjs01477@gmail.com>
This commit is contained in:
parent
d52e0b6a05
commit
9654e51bd4
@ -137,11 +137,12 @@ public abstract class AbstractUserDetailsAuthenticationProvider
|
||||
}
|
||||
catch (UsernameNotFoundException ex) {
|
||||
this.logger.debug(LogMessage.format("Failed to find user '%s'", username));
|
||||
String message = this.messages.getMessage("AbstractUserDetailsAuthenticationProvider.badCredentials",
|
||||
"Bad credentials");
|
||||
if (!this.hideUserNotFoundExceptions) {
|
||||
throw ex;
|
||||
}
|
||||
throw new BadCredentialsException(this.messages
|
||||
.getMessage("AbstractUserDetailsAuthenticationProvider.badCredentials", "Bad credentials"));
|
||||
throw new BadCredentialsException(message, ex);
|
||||
}
|
||||
Assert.notNull(user, "retrieveUser returned null - a violation of the interface contract");
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user