在 spring 网络安全中使用 url 之前的通配符授权请求
authorize request with wildcard preceding url in spring web security
我有一个形式为
的休息端点
{路径变量}/foo/
我想允许访问此 url:
httpSecurity
.authorizeRequests()
// Allow following urls to be called without authentification
.antMatchers("**/foo").permitAll()
我在上面尝试的方法不起作用。有人可以帮忙吗?
自己找到的:http://docs.spring.io/spring/docs/current/javadoc-api/org/springframework/util/AntPathMatcher.html
.antMatchers("/{路径变量:[0-9A-Za-z]+}/评论")
我有一个形式为
的休息端点{路径变量}/foo/
我想允许访问此 url:
httpSecurity
.authorizeRequests()
// Allow following urls to be called without authentification
.antMatchers("**/foo").permitAll()
我在上面尝试的方法不起作用。有人可以帮忙吗?
自己找到的:http://docs.spring.io/spring/docs/current/javadoc-api/org/springframework/util/AntPathMatcher.html
.antMatchers("/{路径变量:[0-9A-Za-z]+}/评论")