这应该很容易。
如果启用了CSRF,则不允许POST和PUT请求,默认情况下,spring boot会启用这些请求。
.csrf().disable()
那是 :
http.
.csrf().disable().
authorizeRequests()
.antMatchers("/admin/**").access("hasRole('ROLE_ADMIN')")
.and()
.formLogin().loginPage("/login").failureUrl("/login?error")
.usernameParameter("username").passwordParameter("password")
.and()
.logout().logoutSuccessUrl("/login?logout")
.and()
.exceptionHandling().accessDeniedPage("/403");
如果需要启用CSRF,请参考docs:
http://docs.spring.io/spring- security/site/docs/4.0.x/reference/htmlsingle/#csrf- configure