mirror of
https://github.com/spring-projects/spring-security.git
synced 2025-06-25 13:32:30 +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) {
|
catch (UsernameNotFoundException ex) {
|
||||||
this.logger.debug(LogMessage.format("Failed to find user '%s'", username));
|
this.logger.debug(LogMessage.format("Failed to find user '%s'", username));
|
||||||
|
String message = this.messages.getMessage("AbstractUserDetailsAuthenticationProvider.badCredentials",
|
||||||
|
"Bad credentials");
|
||||||
if (!this.hideUserNotFoundExceptions) {
|
if (!this.hideUserNotFoundExceptions) {
|
||||||
throw ex;
|
throw ex;
|
||||||
}
|
}
|
||||||
throw new BadCredentialsException(this.messages
|
throw new BadCredentialsException(message, ex);
|
||||||
.getMessage("AbstractUserDetailsAuthenticationProvider.badCredentials", "Bad credentials"));
|
|
||||||
}
|
}
|
||||||
Assert.notNull(user, "retrieveUser returned null - a violation of the interface contract");
|
Assert.notNull(user, "retrieveUser returned null - a violation of the interface contract");
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user