@Bean
public SecurityFilterChain filterChain(HttpSecurity http)throws Exception{
return http.
authorizeRequests()
.requestMatchers("/login","/signup","/user").permitAll()
.anyRequest().authenticated()
.and()
.formLogin((formLogin) ->
formLogin
.loginPage("/login")
.defaultSuccessUrl("/articles")
)
.logout((logoutConfig) ->
logoutConfig
.logoutSuccessUrl("/login")
.invalidateHttpSession(true))
.csrf((csrfConfig) ->
csrfConfig.disable()
)
.build();
}