[英]Spring Security disable security for requests made FROM a certain url
我的应用程序使用Spring Security。 我知道您可以使用antMatchers来允许请求一些映射到您的应用程序中的URI。 但是我也需要允许从外部api向我的应用程序中的URI发出请求,并且仅针对该api。 我需要这样的东西:
@Override
protected void configure(WebSecurity web) throws Exception
{
web.ignoring()
.antMatchers("http://externalTestApi.com");
}
有人知道这是否可能吗? 我没有找到任何东西。
您可以执行以下操作(如果要合并多个条件)
.authorizeRequests()
.antMatchers("/user/list")
.access("authenticated or hasIpAddress('666.666.666.666') or hasIpAddress('127.0.0.1') or hasIpAddress('0:0:0:0:0:0:0:1')")
要么
.authorizeRequests()
.antMatchers("/user/list")
.hasIpAddress("0.0.0.0/0");
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.