Forum Discussion

julienQc's avatar
julienQc
Occasional Contributor
6 years ago

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

Hi,

 

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 !

  • julienQc's avatar
    julienQc
    Occasional Contributor

    I think I've found the solution :

     

    Adding

    @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