Added securityDefinition to Swagger schema#47
Open
frnknglrt wants to merge 2 commits intonielsfalk:masterfrom
Open
Added securityDefinition to Swagger schema#47frnknglrt wants to merge 2 commits intonielsfalk:masterfrom
frnknglrt wants to merge 2 commits intonielsfalk:masterfrom
Conversation
Collaborator
|
I'm more than happy to merge this. However, I do need tests to verify that it works before doing so. Thanks for your contribution! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Reason of change
The current implementation of swagger v2 schemas did not support security defintions to specify the authentication methods for different endpoints. However, the security annotation for each operation was already present. This pull request now allows it to specify the security defintion for swagger v2 schemas.
Example
Setup
Usage
Limitations
I did not change the security defintion of generated openapi schemas. There, it was already possible to specify a security definition (using maps). Reworking this part may break existing implementations which rely on setting the securityDefinition via map.
Specifying the authentication does not hook with the ktor authentication. It only provides an information for generating the correct schema. In order to actually enforce the authentication, ktors
authenticate(){/*...*/}may be used.