尽管CSRF被禁用,但在Spring Boot安全性中获取403 Forbidden错误



由于某种原因,当我尝试对Spring Boot执行任何操作时,它会出现403 Forbidden错误。我目前在SecurityConfiguration类的configure方法中有以下内容:

@Override
protected void configure(HttpSecurity http) throws Exception {
http.csrf().disable().authorizeRequests()
.antMatchers("/*", "/console").permitAll()
.antMatchers(HttpMethod.POST, "/login").permitAll()
.anyRequest().authenticated()
.and().addFilterBefore(new LoginFilter("/login", authenticationManager()),
UsernamePasswordAuthenticationFilter.class)
.addFilterBefore(new AuthenticationFilter(), UsernamePasswordAuthenticationFilter.class);
}

我是Spring boot这一部分的新手,所以不确定这是否是导致它的原因。

结果。。。我是个白痴。这根本不是CSRF造成的。。。这是因为我是英国人,我在身份验证过滤器中拼写了应该是授权的内容,这让其他一切都窒息了。

最新更新