【发布时间】:2015-08-05 12:10:38
【问题描述】:
我尝试配置 Spring Security。我有以下配置:
@Override
protected void configure(HttpSecurity http) throws Exception {
http
.csrf().disable()
.authorizeRequests()
.antMatchers("/auth**").permitAll()
.and()
.authorizeRequests()
.antMatchers("/**").authenticated()
.anyRequest().permitAll()
.and()
.httpBasic()
.and()
.sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS)
.and()
.userDetailsService(userDetailsService());
}
我可以发送 get-request 到以“/auth”开头的链接,但不能在没有身份验证的情况下发送 post-request。如果我删除跟随代码一切正常:
.authorizeRequests()
.antMatchers("/**").authenticated()
.anyRequest().permitAll()
但我需要在任何页面上进行身份验证,“/auth**”除外
【问题讨论】:
标签: spring-security