1
    curl -X 'GET' \
  'http://localhost:8080/url/of/my/endpoint' \
  -H 'accept: application/json' \
  -H 'Authorization: Bearer "token"

I want to get rid of 'Bearer' keyword in the Authorization header. how should I do that?

my swaggerconfig

     @Bean
  public OpenAPI ultronProAPI() {
    final String securitySchemeName = "bearerAuth";
    return new OpenAPI()
            .addSecurityItem(new SecurityRequirement().addList(securitySchemeName))
            .components(new Components()
                    .addSecuritySchemes("bearer-key",
                            new SecurityScheme().type(SecurityScheme.Type.HTTP).scheme("bearer").bearerFormat("JWT")))
            .info(new Info().title("Ultron API")
                    .description("Maestro Ultron")
                    .license(new License().name("Apache 2.0").url("http://springdoc.org")));
  }

my Controller has this annotation:

@SecurityRequirement(name = "bearer-key")
rushikesh chaskar
  • 642
  • 1
  • 7
  • 12

0 Answers0