-
Notifications
You must be signed in to change notification settings - Fork 199
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add global level security schemes to collection level auth #217
Merged
Merged
Changes from 2 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
b5f546d
Add global level security schemes to collection level auth
umeshp7 f4b0ab2
Add unit test case file for testing
umeshp7 4e4cc31
Add test case for empty auth at collection level
umeshp7 f9bc544
Remove inherit test case as, inherit is not a type in postman
umeshp7 65dfe98
Add test case file
umeshp7 8782534
Update auth assignment at collection level
umeshp7 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
openapi: 3.0.0 | ||
info: | ||
title: "Reproduce Authorization issue" | ||
version: 0.0.1 | ||
security: | ||
- MyAuth: [] | ||
- BearerAuth: [] | ||
paths: | ||
/health: | ||
get: | ||
summary: "health" | ||
description: "Health check - always returns OK" | ||
operationId: "get_healthz" | ||
responses: | ||
'200': | ||
description: "OK" | ||
content: | ||
text/plain: | ||
schema: | ||
type: "string" | ||
default: "OK" | ||
/status: | ||
get: | ||
summary: "status" | ||
description: "Returns the service version" | ||
operationId: "get_status" | ||
responses: | ||
'200': | ||
description: "Service info multi-line string" | ||
content: | ||
text/plain: | ||
schema: | ||
type: "string" | ||
components: | ||
securitySchemes: | ||
BearerAuth: | ||
type: http | ||
scheme: bearer | ||
bearerFormat: token | ||
MyAuth: | ||
type: apiKey | ||
description: "This is my auth" | ||
name: Mera-Auth | ||
in: header |
This file contains 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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will be executed regardless of line 260 🤔
Can you also add a regression test for this specific case? There should be a case that tests for collection.auth eing empty if in='header'/'query'
Also, why are we doing this in the first place? Why can't apiKey auths be left in the collection.auth property?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will make the changes and add the test case.
Adding apiKey to collection.auth property which is not recognized as one of the known formats results in an empty selection in the collection level auth dropdown in Postman app. It doesn't default to 'noauth'.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What happens if
type
is apikey, butin
isn't header/query?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops! Made changes. @abhijitkane
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@abhijitkane
if type is
apikey
, butin
isn't header/query - we should add the auth to collection. So I have made the required changes. Only in case of api-key and header/query the collection level auth will be 'noauth'. Rest of the cases we will add it directly.