Skip to content

Commit 26ae590

Browse files
codeconsoleeleftherias
authored andcommitted
Check that userdetails for username exists. #7251
1 parent 8773c79 commit 26ae590

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

web/src/main/java/org/springframework/security/web/authentication/rememberme/TokenBasedRememberMeServices.java

+5
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,11 @@ protected UserDetails processAutoLoginCookie(String[] cookieTokens,
123123
UserDetails userDetails = getUserDetailsService().loadUserByUsername(
124124
cookieTokens[0]);
125125

126+
if (userDetails == null) {
127+
throw new InvalidCookieException("Cookie token[0] contained username '"
128+
+ cookieTokens[0] + "' that does not exist.");
129+
}
130+
126131
// Check signature of token matches remaining details.
127132
// Must do this after user lookup, as we need the DAO-derived password.
128133
// If efficiency was a major issue, just add in a UserCache implementation,

0 commit comments

Comments
 (0)