Skip to content

Multiple SecurityRequirements annotations with AND condition #3556

@miloszwatroba

Description

@miloszwatroba

Hi!
I found a problem with adding multiple security requirements via annotations. I see that there is an old, closed ticket #1261, which was concerning this issue. Although the ticket was closed, I think that the issue was not resolved. I see that the possibility to add multiple requirements with "AND" condition was added to the swagger-models, whereas the ticket was actually concerning swagger-annotations.

I would like to bring it up again. I've just looked through the documentation and code, and it seems that there is no possibility to add multiple SecurityRequirement annotations and tie them with an "AND" condition. By default, the requirements added within that annotation are generated with an "OR" conjunction.

We can see that in SecurityRequirements.java, there is only an array of SecurityRequirement allowed, which in turn has only name and scopes parameters. This is not in line with the model, where the SecurityRequirement is actually a Map of names and scopes, which allows for the "AND" condition. Therefore, I don't see any option to use the annotations with an "AND" condition.

Am I missing something? Is there a reason for the fact that the swagger-annotations lack this functionality?

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