dropwizard-swagger icon indicating copy to clipboard operation
dropwizard-swagger copied to clipboard

Swagger-ui custom header parameters (e.g. Basic auth)

Open aaaaahaaaaa opened this issue 9 years ago • 3 comments

It would be great to have a way to customize swagger-ui headers through Dropwizard-swagger in order to enable Basic Auth for example (see https://github.com/swagger-api/swagger-ui#custom-header-parameters---for-basic-auth-etc). Currently, Dropwizard-swagger is useless if Basic authentication is enabled on Dropwizard because there is no way to enter credentials through Swagger-ui.

aaaaahaaaaa avatar Apr 22 '15 03:04 aaaaahaaaaa

+1 to this. It'd be really nice to have this.

ykim avatar Apr 28 '15 18:04 ykim

It may not address your issue, but @ApiImplicitParam may be worth looking into. It should allow you to pass extra headers or query params from the Swagger UI that aren't marked on your Resource method.

There is, however, one (huge) gotcha. There's a bug in the Swagger code that the current version of this library uses that doesn't correctly parse @ApiImplicitParam. Upgrading to a newest version of the libraries addresses this, but requires work due to repackaging of the latest versions of Swagger JARs.

tfeak avatar Sep 16 '15 22:09 tfeak

I created a PR there to add this feature

akraxx avatar Sep 28 '15 09:09 akraxx