Skip to content

Multiple SecurityScheme annotations result in no security scheme #249

Closed
@dlamoris

Description

@dlamoris

Hi, not sure if this is a bug or if I'm doing something wrong:
I have a spring boot application with this annotation

@SpringBootApplication(scanBasePackages = "packages")
@OpenAPIDefinition(
    info = @Info(
       ...
    ),
    servers = {
    },
    security = {@SecurityRequirement(name = "basicAuth"), @SecurityRequirement(name = "bearerToken")}
)
@SecuritySchemes({
    @SecurityScheme(
        name = "basicAuth",
        type = SecuritySchemeType.HTTP,
        scheme = "basic"
    ),
    @SecurityScheme(
        name = "bearerToken",
        type = SecuritySchemeType.HTTP,
        scheme = "bearer",
        bearerFormat = "JWT"
    )
})
public class ExampleApplication {

I've also tried not using @SecuritySchemes and just putting the two @SecurityScheme, both result in the yaml having no securitySchemes in component.

If I only have 1 top level @SecurityScheme, then it works.
How can I add multiple security schemes?

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions