[19.0] [IMP] webservice: configurable OAuth2 token request#143
Open
ivantodorovich wants to merge 3 commits into
Open
[19.0] [IMP] webservice: configurable OAuth2 token request#143ivantodorovich wants to merge 3 commits into
ivantodorovich wants to merge 3 commits into
Conversation
Contributor
|
Hi @etobella, |
d3ee41b to
2d54f31
Compare
Until now the OAuth2 "Backend Application (Client Credentials)" flow
always requested the token in one fixed way: an HTTP POST where the
client id and secret were turned into an HTTP Basic Authorization header
(this is what oauthlib does by default). Providers that deviate from
that could not be used.
Two configuration options are added to the webservice backend so those
providers can be supported through configuration only:
- Token Request Method: POST (default) or GET, for providers that expose
the token endpoint as a GET.
- Client Authentication: how the client credentials are presented to the
token endpoint:
* Client ID & Secret (HTTP Basic) (default): the previous behavior,
unchanged.
* Custom Authorization header: a static, verbatim header value (for
example "SSWS <token>"). In this case the Client ID / Client Secret
fields are not used; the header name and value are configured
directly instead.
The defaults keep the exact same behavior as before, so existing
backends are not affected. The custom header is injected through a small
requests auth handler so that oauthlib does not overwrite it with its
automatic Basic Authorization header.
Two validation rules make sure the right fields are filled in depending
on the chosen client authentication: the client id and secret for the
HTTP Basic method, or the header name and value for the custom header
method.
There was a misuse of `and` instead of `or` in the `invisible` attribute of some fields that are specific to the Web Application flow
2d54f31 to
fd38ba6
Compare
The webservice module gained new OAuth2 configuration fields (the token request method, the client authentication method, and the custom Authorization header name and value). These are now also manageable through server environment configuration files, like the other webservice fields.
fd38ba6 to
5c14c1f
Compare
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.
Some providers require the credentials in a non-standard Authorization header (for instance Okta uses
Authorization: SSWS <token>).This PR makes it possible. Such an endpoint can be configured as:
Additionally, the provider might only reply to
GETinstead ofPOST, so the token request method is configurable now too.