I am trying to make some security configurations in my SwaggerConfiguration class. My purpose is sending scheme keyword with authentication key like
curl -X GET "http://localhost:8080" -H "accept: */*" -H "Authorization: Bearer <authorization-value>"
or
curl -X GET "http://localhost:8080" -H "accept: */*" -H "Authorization: ApiKey <authorization-value>"
It is possible on ASP.Core but I can only achive this on java like this:
What shall I use for my Docket security scheme instead of ApiKey?
Docket docket = new Docket(DocumentationType.SWAGGER_2)
.select()
.apis(RequestHandlerSelectors.basePackage("mypackagename"))
.build()
.useDefaultResponseMessages(false)
.apiInfo(metaData())
.securitySchemes(Collections.singletonList(getApiKey()))
.securityContexts(Collections.singletonList(securityContext()));
private ApiKey getApiKey() {
return new ApiKey("apiKey", "Authorization", "Header");
}
