Handle null UserDetails in TokenBasedRememberMeServices - #19672
Closed
GangEunzzang wants to merge 1 commit into
Closed
Handle null UserDetails in TokenBasedRememberMeServices#19672GangEunzzang wants to merge 1 commit into
GangEunzzang wants to merge 1 commit into
Conversation
onLoginSuccess reads getPassword() on the UserDetails returned by the UserDetailsService without checking it, so a service that returns null throws a NullPointerException. Return without setting a cookie instead, as is already done when the password is missing. Closes spring-projectsgh-19535 Signed-off-by: 이강은 <rkddms123456@gmail.com>
Author
|
Closing — #19552 already has this exact change, with the reporter's feedback folded in, and I missed it before opening this one. Sorry for the noise. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
TokenBasedRememberMeServices#onLoginSuccessfalls back toUserDetailsService#loadUserByUsernamewhen theAuthenticationcarries no password, and then readsgetPassword()on the result without checking it. AUserDetailsServicethat returnsnullfor a user (the reporter's case: only some users support remember-me) therefore throws aNullPointerExceptionon login.The method already returns without setting a cookie when the password cannot be obtained, so a
nullUserDetailsnow takes the same path, with its own debug message.Adds
loginSuccessWhenUserDetailsServiceReturnsNullThenNoCookieIsSet, built on the existingudsWillReturnNull()setup; it throws onmainand passes here.Closes gh-19535