How do I define basic authentication using Swagger 2.0 annotations and have it display in swagger UI.
In the resource I have:
@ApiOperation(value = \"Re
I struggeled with this as well. In my case i used the swagger-maven-plugin. To solve this i added this within the maven plugin:
basicAuth
basic
After that i was able to add it on my resource like this:
@Api(value = "My REST Interface", authorizations = {@Authorization(value="basicAuth")})
The generated json included the security element for each endpoint:
"security":[{
"basicAuth" : []
}]
And the security definition:
"securityDefinitions" : {
"basicAuth" : {
"type" : "basic"
}
}
I hope this helps others as well.