Check that userdetails for username exists. #7251

This commit is contained in:
Scott Murphy 2019-08-11 13:21:37 -06:00 committed by Eleftheria Stein
parent 8773c7994f
commit 26ae590c68
1 changed files with 5 additions and 0 deletions

View File

@ -123,6 +123,11 @@ public class TokenBasedRememberMeServices extends AbstractRememberMeServices {
UserDetails userDetails = getUserDetailsService().loadUserByUsername(
cookieTokens[0]);
if (userDetails == null) {
throw new InvalidCookieException("Cookie token[0] contained username '"
+ cookieTokens[0] + "' that does not exist.");
}
// Check signature of token matches remaining details.
// Must do this after user lookup, as we need the DAO-derived password.
// If efficiency was a major issue, just add in a UserCache implementation,