microservices-single-swagger icon indicating copy to clipboard operation
microservices-single-swagger copied to clipboard

How to add authorization header

Open ghsatpute opened this issue 6 years ago • 0 comments

I want to add authorization header to all microservices. Which will be intercepted at Gateway Proxy level.

I can do this using following piece of code without aggregation.

    @Bean
    public Docket api() {
        return new Docket(DocumentationType.SWAGGER_2)
            .select()
            .apis(RequestHandlerSelectors.any())
            .paths(PathSelectors.any()).build().pathMapping("")
            .securitySchemes(Arrays.asList(apiKey()));
    }

    private ApiKey apiKey() {
        return new ApiKey("authkey", "Authorization", "header");
    }

But when I use public class SwaggerAggregatorController implements SwaggerResourcesProvider { the authorization button does not show up on the UI.

ghsatpute avatar Jul 04 '18 07:07 ghsatpute