spring-projects / spring-projects/spring-session
SpringSessionRememberMeServices does not use RememberMeAuthenticationToken
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 1.9k
- Forks
- 1.2k
- Avg merge
- 4h 27m
- Merged PRs (30d)
- 55
Description
Describe the bug
If a security context has been created via a "remember me" mechanism rather than fresh credentials, this should be expressed via a RememberMeAuthenticationToken. This is required so that assertions such as fullyAuthenticated() work correctly.
To Reproduce
Spring Boot application with the following config:
@Bean
public SecurityFilterChain securityFilterChain(HttpSecurity http) {
return http.securityMatcher("/**")
.formLogin(config -> config.permitAll())
.rememberMe(config -> config.rememberMeServices(new SpringSessionRememberMeServices())
.authorizeHttpRequests(authorize -> authorize
.requestMatchers("/sensitive").fullyAuthenticated()
.anyRequest().authenticated()
).build();
}
- Start server and browser
- Login to application with "remember me" selected
- Visit
/sensitive - Restart browser
- Visit
/sensitive
Expected behavior
Accessing /sensitive should trigger a login flow, as with the default .rememberMe() behaviour.
Additional context
Due to the implementation of just extending the current session, there is no way to tell whether the user has entered their credentials in the current browser session or not.
If "wontfix", then there should at least be a big warning somewhere that this breaks fullyAuthenticated().
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 at the SpringSessionRememberMeServices entry point and trace how a remembered session restores the security context. Reproduce the supplied Spring Boot flow, then verify that visiting /sensitive after restarting the browser triggers login through fullyAuthenticated().
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, spring, spring-boot
- Domain
- authentication, security
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100