I have the following SecurityScheme definition using springdoc-openapi for java SpringBoot RESTful app:
@Bean
public OpenAPI customOpenAPI() {
re
Tested with v1.2.29 of springdoc-openapi: Its possible to disable security for particular Endpoint using: @SecurityRequirements
@GetMapping("/open")
@ResponseBody
@SecurityRequirements
public String open() {
return "It works!";
}
For older versions, for example tested with v1.2.28 using OperationCustomizer:
public static final String UNSECURED = "security.open";
@Bean
public OperationCustomizer customize() {
return (Operation operation, HandlerMethod handlerMethod) -> {
List tags = operation.getTags();
if (tags != null && tags.contains(UNSECURED)) {
operation.setSecurity(Collections.emptyList());
operation.setTags(tags.stream()
.filter(t -> !t.equals(UNSECURED))
.collect(Collectors.toList()));
}
return operation;
};
}