Closed
Description
Is your feature request related to a problem? Please describe.
- When I'm Developing Spring Cloud based Microservices
- then I meet Springdoc-Openapi-starter couldn't make OpenAPI with global security schemes in AutoConfiguration of Spring Boot's
Describe the solution you'd like
- If We pre-defined global security scheme, in yaml or properties could be managed by Spring Cloud Config Server
springdoc:
api-docs:
path: /v3/api-docs
swagger-ui:
path: /swagger-ui.html
security-schemes:
bearerAuth:
type: http
scheme: bearer
bearerFormat: JWT
like we already defined on config class and RESTcontroller
@Configuration
public class SwaggerConfig {
@Bean
public OpenAPI customOpenAPI() {
return new OpenAPI().components(new Components()
.addSecuritySchemes("basicScheme", new SecurityScheme()
.type(SecurityScheme.Type.HTTP).bearerFormat("JWT").scheme("bearer")));
}
}
---
@OpenAPIDefinition(security = @SecurityRequirement(name = "bearerScheme"))
@Slf4j
@RestController
@RequestMapping("/v1")
@RequiredArgsConstructor
public class ProfileRestController {
- What is the expected result using OpenAPI Description (yml or json)?
- like following json, springdoc-openapi automatic created api-doc will like following
{
"openapi": "3.0.1",
"servers": [
{
"url": "http://localhost:53646",
"description": "Generated server url"
}
],
"security": [
{
"bearerScheme": []
}
],