Configuring the persistent-based remember-me feature
Finally, we’ll need to make some brief configuration changes to the rememberMe declaration to point it to the data source we’re using, as shown in the following code snippet:
//src/main/java/com/packtpub/springsecurity/configuration/SecurityC onfig.java
@Bean
public SecurityFilterChain filterChain(HttpSecurity http, PersistentTokenRepository persistentTokenRepository) throws Exception {
http.authorizeRequests( authz -> authz
...
// Remember Me
http.rememberMe(httpSecurityRememberMeConfigurer -> httpSecurityRememberMeConfigurer
.key("jbcpCalendar").tokenRepository(persistentTokenRepository));
return http.build();
}
@Bean
public PersistentTokenRepository persistentTokenRepository(DataSource dataSource) {
...