java - 蚂蚁匹配器以
问题描述
我的 spring 安全配置需要一个 ant matcher。此匹配器应匹配以下网址
- /健康
- /控制器/健康
现在我有这个 .antMatchers("/health").permitAll()
,但这拒绝/contolller/health
然后我尝试.antMatchers("/*/health").permitAll()
了,但这拒绝了/health
那么有什么建议吗?
PS 我想使用 antMatchers 方法,而不是 regexMatchers
解决方案
.antMatchers("/health")
仅指特定的蚂蚁。
您可以添加“/**”.antMatchers("/controller/**")
来引用其所有子文件夹
您可以在 /health 之前添加“**/”.antMatchers("/**/health")
以匹配位于任何位置的“health”目录或.antMatchers("/**/health/**")
匹配位于任何位置的“health”目录中的所有文件
或者.antMatchers("/health", "/contoller/health")
用逗号写所有特定的子文件夹。
推荐阅读
- tensorflow - 如何让 Tensor flow train.py 使用所有可用的 GPU?
- javascript - 获取具有特定名称的 cookie
- javascript - 有没有办法使用 JavaScript 发布 webhook?
- php - 如何在重定向语句中添加变量?
- regex - 正则表达式 - 为什么这两个表达式不产生相同的结果?
- maven - 当从父级调用时,MavenProject getArtifacts 在模块上返回不同的列表
- laravel - Laravel 合并逻辑
- angular - FB.ui 共享对话框:“此 URL 的域不包含在应用程序的域中”
- python - 如何使用 RSA 方案加密字符串?
- java - 了解合并排序