Skip to content

Make Spring Boot / Security login-endpoint automatically visible in SwaggerUI? #827

Closed
@retrofreak83

Description

@retrofreak83

I have implemented a REST API using Spring Boot and a running OpenAPI documentation using SpringDoc.

The authentication is done without OAuth, but using Spring Secutiry and JWT/JWS. So, there is the "login"-endpoint automagically provided by Spring.

Using SecurityScheme, I enabled authentication for SwaggerUI:

        new SecurityScheme ().name (securitySchemeName)
          .type (SecurityScheme.Type.HTTP)
          .scheme ("bearer")
          .bearerFormat ("JWT")))

This works fine so far, meaning, as long as the user already has his Base64-encoded JWT at hand, he can use it to login and use SwaggerUI to issue authenticated requests.

But: to do this, he must first issue a login request "out of band", via a curl request for example, to authenticate and retrieve the JWT. is there a way to also have the login endpoint as part of the SwaggerUI automatically (i.e. in a generated way), so that it can also be used by the user to conveniently log in?

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions