spring-projects / spring-projects/spring-security
SEC-3184: PersistentTokenBasedRememberMeServices.logout doesn't work properly with SessionCreationPolicy.STATELESS
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 9.6k
- Forks
- 6.3k
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 52
Description
Scott Albertine (Migrated from SEC-3184) said:
In the PersistentTokenBasedRememberMeServices.logout method, there's a clause that (as it should) deletes all persisted tokens for the current user, assuming we know who the current user is. This is great! However, in my application, I'm using SessionCreationPolicy.STATELESS, to disable in-memory sessions, for clustering purposes. Thus, on any POST to /logout, the only authentication the user has is the RememberMe token that we're trying to clear. This is a problem, because due to the ordering of filters set in FilterComparator, the LogoutFilter that triggers this handler happens BEFORE the RememberMeAuthenticationFilter, which means that there is no way for the LogoutFilter to know which user we're authenticated as, and thus we never remove the user tokens.
This can be fixed by re-ordering the filters in FilterComparator to put the LogoutFilter after the RememberMeAuthenticationFilter.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with FilterComparator and PersistentTokenBasedRememberMeServices.logout to trace the filter ordering during a stateless POST to /logout. Verify that the ordering lets the remember-me authentication identify the user before logout clears persisted tokens, and confirm that the reported token-removal behavior is fixed.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, spring
- Domain
- authentication, security
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100