【发布时间】:2019-11-28 20:30:11
【问题描述】:
我试图忽略来自身份验证的 url 我尝试了多种不同的模式,但 java 似乎无法识别它们。我的配置如下所示:
@Override
public void configure(WebSecurity web) throws Exception {
super.configure(web);
web.ignoring().antMatchers(
"/api/pies.*active=true");
}
我想要匹配并忽略 spring 安全性的字符串是这样的: http://"someEnv"/"somePath"/api/pies?active=true
但是,无论我尝试什么通配符组合,它都不匹配。 匹配必须有 ?active=true
下面是方法def:
@GetMapping()
public ResponseEntity<List<PieResponseDto>> getPies(@RequestParam(name = "active") Boolean active)
下面是类定义:
@RestController
@RequestMapping(path = "/api/pies", produces = MediaType.APPLICATION_JSON_VALUE)
【问题讨论】:
-
就是这样。我将它切换到 regexMatchers 并且它有效!谢谢~!
标签: java regex spring-security