[英]Spring Security disable method security
尽管有很多资源指出如何禁用Spring Security,但是没有有关如何禁用方法安全性的说明。
一个例子:
@SpringBootApplication(
exclude = SecurityAutoConfiguration.class
)
但是,这不会阻止MethodSecurityInterceptor
插入,随后是AuthenticationCredentialsNotFoundException
。
是否有一种方便的方法可以在不删除所有注释的情况下禁用方法安全性?
编辑:
我在说
@EnableGlobalMethodSecurity(prePostEnabled = true, securedEnabled = true)
其次是
@PreAuthorize("hasAuthority('SOME_AUTHORITY')")
编辑2:
如前所述,您无法通过将参数设置为false来禁用全局方法安全性:
Caused by: java.lang.IllegalStateException: In the composition of all global method
configuration, no annotation support was actually activated
事实证明,在应用程序中的某个位置已创建了自定义GlobalMethodSecurityConfiguration
。 当然,这是上述问题的原因。 删除(或将其移至锯齿状的轮廓)后,问题消失了。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.