允许基于掩码的URL请求

时间:2019-03-04 13:44:16

标签: spring security

我希望将Spring Security配置为允许基于掩码的请求:

/{localization}/payment/{transaction_id}

这正确吗?

http.authorizeRequests().antMatchers("/*/payment/*").permitAll().anyRequest().permitAll();

还是我需要使用它?

http.authorizeRequests().antMatchers("/**/payment/**").permitAll().anyRequest().permitAll();

我应该使用哪个?

1 个答案:

答案 0 :(得分:0)

如果路径中不需要更多目录,则第一个就足够了。

  • *匹配零个或多个字符
  • **匹配零个或多个 路径中的目录

来源:https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/util/AntPathMatcher.html

相关问题