Skip to content

Commit e21f02d

Browse files
committed
Include UsernameNotFoundException in BadCredentialsException
Closes gh-16496 Signed-off-by: dae won <[email protected]>
1 parent 2aa2e64 commit e21f02d

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

core/src/main/java/org/springframework/security/authentication/dao/AbstractUserDetailsAuthenticationProvider.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,9 @@ public Authentication authenticate(Authentication authentication) throws Authent
137137
if (!this.hideUserNotFoundExceptions) {
138138
throw ex;
139139
}
140-
throw new BadCredentialsException(this.messages
141-
.getMessage("AbstractUserDetailsAuthenticationProvider.badCredentials", "Bad credentials"));
140+
String message = this.messages.getMessage("AbstractUserDetailsAuthenticationProvider.badCredentials",
141+
"Bad credentials");
142+
throw new BadCredentialsException(message, ex);
142143
}
143144
Assert.notNull(user, "retrieveUser returned null - a violation of the interface contract");
144145
}

0 commit comments

Comments
 (0)