Remember Me 설정
1. Remember Me Configuration 설정 (구버전)
@Configuration
@EnableWebSecurity
@NoArgsConstructor
public class SecurityConfig {
@Bean
public SecurityFilterChain fileterChain(HttpSecurity http) throws Exception {
private UserDetailsService userDetailsService;
http
.rememberMe()
.rememberMeParameter("remember") // 파라미터명 설정
.tokenValiditySeconds(3600) // 리멤버미 토큰의 유효기간 설정 >> defalut 값 : 14days
.userDetailsService(userDetailsService)
;
return http.build();
}
}
2. Remember Me Configuration 설정 (신버전)
@Configuration
@EnableWebSecurity
@NoArgsConstructor
public class SecurityConfig {
@Bean
public SecurityFilterChain fileterChain(HttpSecurity http) throws Exception {
private UserDetailsService userDetailsService;
http
.rememberMe(form ->
form
.rememberMeParameter("remember")
.tokenValiditySeconds(3600)
.userDetailsService(userDetailsService)
);
return http.build();
}
}
3. 설정 후 출력결과
Comments