Spring - Bypass Security for specific path


@RestController
@RequestMapping("/foo")
public class Foo {

    @Bean
    public WebSecurityCustomizer webSecurityCustomizer() {
        return (web) -> web.ignoring().requestMatchers("/specimen/**");
    }

    @PostMapping("/post")
    public Result post(@RequestBody Payload payload) {
        ...
    }

    @GetMapping("/get")
    public Result get(@RequestParam String id) {
       ...
    }

    @GetMapping("/otherget/{id}")
    public Result otherget(@PathVariable id) {
       ...
    }

}

java

Back