
这应该很容易。
如果启用了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
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)