I just read answer from the another question What is the use of @EnableWebSecurity in Spring?, but i couldn't understand why we need to add @EnableWebSecurity annotation at all.
Even I remove the @EnableWebSecurity from the configuration, my application still works.
Let's assume that we are going to implement either JWT based (rest api) or simply login based mvc application. For the following configuration what i am missing?
@Component
public class SecurityConfiguration extends WebSecurityConfigurerAdapter {
@Bean
public UserDetailsService userDetailsService() {
return new MyCustomUserDetailsService();
}
@Bean
public PasswsordEncoder passwsordEncoder() {
return new BrcyptPasswordEncoder();
}
@Override
protected void configure(HttpSecurity http) throws Exception {
// for the jwt authentication add jwt filter etc ..
// for the login based, override default login page, error page etc..
}
}