feat: add Bearer security scheme & apply globally #179
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.
Fixes #151
This PR is an alternative to #162, raised in response to an evaluation of the security definitions across a range of GA4GH OpenAPI specs. It precisely follows the definition and application of security schemes in the GA4GH Service Registry and Service Info specifications.
The reasoning to define only the Bearer authentication security scheme (as opposed to specifying Bearer, Basic and Passport-based schemes as in #162) is as follows:
apiKey
, but in spirit resembles Bearer authentication, and its definition as typeapiKey
is likely an artifact of a previous OpenAPI/Swagger 2.0 version of the specification (OpenAPI/Swagger 2.0 does not explicitly support Bearer authentication), as mentioned in this comment.usernam:password
string passed in theAuthorization
header, is one of the security schemes defined in the DRS specification. And while this type of Authorization/Authentication is certainly useful for what are basically data object repositories, which, presumably, would frequently have frontends that users could log into to browse available objects, TES implementations are not very likely to be used in this way, and so, in my opinion, the case for mandating its adoption across TES implementations is weak. Moreover, Basic authentication may pose a security risk if not combined with additional measures of security.The reasoning to apply the Bearer authentication security scheme globally, i.e., to all operations, is as follows:
Note that definitions for
401/Unauthorized
responses were deliberately not added to the operations as part of this PR, as the TES specification (unlike other GA4GH OpenAPI specifications) does currently not specify any specific error responses to operations, such as400/Bad Request
or404/Not Found
. If desired for clarity and/or consistency, those could be added in a different PR.