Ivajkin
5/10/2014 - 4:10 AM

HttpSecurity под Spring Security из http://docs.spring.io/autorepo/docs/spring-security/3.2.x/apidocs/org/springframework/security/config/an

@Configuration
@EnableWebSecurity
public class SecurityConfig extends WebSecurityConfigurerAdapter {

    @Override
    protected void configure(AuthenticationManagerBuilder auth)
            throws Exception {
        auth
             .inMemoryAuthentication()
                  .withUser("user").password("password").roles("USER");
    }

    @Override
    protected void configure(HttpSecurity http) throws Exception {
        http
            .authorizeRequests()
                .antMatchers("/**").hasRole("USER")
                .and()
            .formLogin()
                .permitAll()
                .and()
            .rememberMe();
    }
}