3
votes

We have a Quarkus application with some secured endpoints. For development and easy testing without much effort, we would like to use Swagger UI as described at https://quarkus.io/guides/openapi-swaggerui. But this seems to only work for unprotected endpoints.

Is there a way to also make request to protected endpoints in Swagger UI?

1

1 Answers

4
votes

You need to add a security scheme to your specification:

One way to do it is by using annotations:

@OpenAPIDefinition(info = @Info(title = "My API", version = "v1"))
@SecurityScheme(
    name = "basicAuth",
    type = SecuritySchemeType.HTTP,
    scheme = "basic"
)
public class ExampleApiApplication extends Application {
}

After you enable security scheme, authorize button will appear on swagger ui. Securirty scheme can be basic, bearer etc..

Authorize button