Forum Discussion

julienQc's avatar
Occasional Contributor
6 years ago

Add basic authentication in swagger-ui in project with Spring-security



I want to add the functionality to authenticate in swagger-ui in order to test protected endpoints.

In previous project with old swagger version and spring-boot with spring-mvc I was able to do that, but I don't know how to do this with my new project.


I'm using :

Spring-boot 2 with spring-security and spring-boot-starter-jersey

swagger 2.0.6 (swagger core v3 with swagger-jaxrs2)

swagger 3.20.3


Thanks for your help !

1 Reply

  • julienQc's avatar
    Occasional Contributor

    I think I've found the solution :



    @SecurityScheme(name = "myHttpSecurity",
            type = SecuritySchemeType.HTTP,
            in = SecuritySchemeIn.HEADER

    Then, the authorize button appears :)

    Now, I still have to find how to print description about security informations in swagger-ui