package io.loli.box;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;

/**
 * @author choco
 */
@EnableWebSecurity
@Configuration
public class SecurityConfig extends WebSecurityConfigurerAdapter {

    @Value("${email}")
    private String email;
    @Value("${password}")
    private String password;

    @Override
    protected void configure(HttpSecurity http) throws Exception {
        http.authorizeRequests().antMatchers("/admin**").hasRole("ADMIN")
                .antMatchers("/admin/**").hasRole("ADMIN").antMatchers("/image/**").permitAll()
                .and().formLogin()
                .permitAll().and().logout().deleteCookies("JSESSIONID").permitAll().and().csrf().disable();
        http.headers().frameOptions().disable().and()
                .rememberMe();
    }

    @Autowired
    public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
        auth.inMemoryAuthentication()
                .withUser(email).password(password).roles("ADMIN");
    }
}

@@ -1254,22 +1254,16 @@
 isable()
-.and()
 %0A       

Update SecurityConfig.java