【发布时间】:2018-12-13 15:10:39
【问题描述】:
下面是我正在使用的 SecurityConfiguration 类。
@SpringBootApplication
@RestController
public class WebMvcConfig {
@Configuration
protected static class SecurityConfiguration extends
WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity http) throws Exception {
http.authorizeRequests()
.antMatchers("/login").permitAll()
.antMatchers("/**").authenticated()
.anyRequest().authenticated()
.and()
.formLogin().permitAll();
}
}
启动后,只要我点击我的 URL (http://localhost:8080/TestApp/),它就会带我到默认登录页面,当我输入默认用户 ID(用户)和密码(打印在控制台上)时,它会带我通过我的 AngularJS 路由到由“/” URL 映射的 index.html 页面。我可以浏览 UI,但是只要我提交任何 $http 请求(我正在尝试使用 POST 请求),它就会在浏览器控制台上使用我的 $http 请求 URL 给我 403。
有人可以帮忙吗?
【问题讨论】:
-
尝试添加
http.csrf().disable();
标签: java angularjs spring-security http-headers http-post