This repository has been archived by the owner on Sep 9, 2024. It is now read-only.
feat: Support custom auth schemes for Github API #1086
Merged
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.
Background
When looking to support custom authentication with Github (by proxying to Github API through a custom authenticated API), the
token
auth-scheme in the Authorization header may not be appropriate.For example, when looking to use AWS Lambda function to proxy Github API requests and using AWS Cognito for authentication (Cognito is the user management service offered by AWS out of the box), authenticated requests to the Lambda function must use
Bearer
scheme.Note: Github API does seem to accept either
Bearer
ortoken
, and even appears to prefer and sometimes mandateBearer
according to their API docs:https://docs.github.com/en/rest/authentication/authenticating-to-the-rest-api?apiVersion=2022-11-28#about-authentication
However - changing this would be a potentially breaking change and I'm hesitant to change something fundamental to the Github backend implementation in this PR. This PR would allow us to test that the normal Github implementation works with the
Bearer
scheme and change that to the new default in future (if desired) - but that's well outside the scope of this change.Changes
authScheme
used inAuthorization
headers for Github backend, defaulting to the expected default value oftoken
.authScheme
works for API spec. No equivalent tests exist in implementation spec so I haven't added equivalent tests for that.