我的 OpenAPI 配置
我需要将标头密钥从授权更改为 Authorization-internal
@Bean
public OpenAPI customOpenAPI(OpenApiConfig config) {
return new OpenAPI().addSecurityItem(new SecurityRequirement().addList("security-schemes"))
.components(new Components().addSecuritySchemes("security-schemes", securitySchema()))
.info(new Info().title(config.getTitle()).contact(contact())
.version(config.getAppVersion())
.description(config.getDescription())
.termsOfService("https://www.batata.com.br/site/")
.license(new License().name("Banco - Batata 1.0").url("https://www.batata.com.br/site/")));
}
private Contact contact() {
return new Contact().name("Banco Batata").url("https://www.batata.com.br/site/").email("developer@batata.com");
}
@Bean
private SecurityScheme securitySchema() {
return new SecurityScheme().type(SecurityScheme.Type.HTTP).scheme("bearer").bearerFormat("JWT")
.in(SecurityScheme.In.HEADER).name("Authorization-internal");
}