2 Securing Web

This example uses WebMvc framework, which uses WebMvcConfigurerAdapter and ViewControllerRegistry to connect the urls and html templates.

Add spring-boot-starter-security into dependency, make WebSecurityConfig.java.

public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
    protected void configure(HttpSecurity http) throws Exception {
                .antMatchers("/", "/home").permitAll()
    public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
        // user repository in memory with username = "user" and password = "password"
        // it is just for demon