I am trying to ignore a url from authentication I've tried multiple different patterns but java doesn't seem to be able to recognize them. My configure looks like this:
@Override
public void configure(WebSecurity web) throws Exception {
super.configure(web);
web.ignoring().antMatchers(
"/api/pies.*active=true");
}
the string I want to match and have spring security ignore is something like this: http://"someEnv"/"somePath"/api/pies?active=true
however no matter what wildcard combo I try it doesn't match. The match has to have ?active=true
Below is the method def:
@GetMapping()
public ResponseEntity<List<PieResponseDto>> getPies(@RequestParam(name = "active") Boolean active)
below is the class def:
@RestController
@RequestMapping(path = "/api/pies", produces = MediaType.APPLICATION_JSON_VALUE)
Use .regexMatchers
instead of .antMatchers
and then try this regex:
^[a-zA-Z:\/.]*pies\?active=true$
There are plenty of online tools for regex expressions. You can try for example this one: online regex tester
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.