Refactor handling of OAuth client tokens - #24684
Closed
NobodysNightmare wants to merge 5 commits into
Closed
Conversation
NobodysNightmare
marked this pull request as draft
August 10, 2026 15:02
NobodysNightmare
force-pushed
the
oauth-client-tokens
branch
from
August 11, 2026 07:43
69485b5 to
db4c95a
Compare
NobodysNightmare
force-pushed
the
oauth-client-tokens
branch
2 times, most recently
from
August 11, 2026 09:04
ea33ca1 to
2b730ff
Compare
NobodysNightmare
force-pushed
the
oauth-client-tokens
branch
5 times, most recently
from
August 12, 2026 06:19
e35547d to
5664fc9
Compare
|
Warning Flaky specs
🤖 Ask Copilot to investigateCopy the prompt below into a new comment on this PR to delegate the investigation to GitHub Copilot. It will look into the flakiness and open a separate pull request with you as reviewer. |
|
Warning Flaky specs
🤖 Ask Copilot to investigateCopy the prompt below into a new comment on this PR to delegate the investigation to GitHub Copilot. It will look into the flakiness and open a separate pull request with you as reviewer. |
NobodysNightmare
marked this pull request as ready for review
August 12, 2026 07:36
NobodysNightmare
force-pushed
the
oauth-client-tokens
branch
3 times, most recently
from
August 12, 2026 08:57
a1e1290 to
92a355d
Compare
This class provides generic helpers to perform OAuth 2.0 token requests, which are not only useful in the context of OpenID Connect, but also for other kinds of OAuth clients.
Previously the fetching and updating of `OAuthClientToken` was left as an implementation detail of specific integrations, even though the concept of `OAuthClient` and `OAuthClientToken` were defined in the core and even their creation is already handled through a core class (the `ConnectionManager`). This commit introduces the `OAuthClients::TokenFetcher` that serves as the new main interface to obtain the access token of an `OAuthClientToken`.
The previous cassette contained a refresh of an OAuth token that was performed through the previous "try-and-error"-based approach for authentication. I.e. the first request failed with an authentication error, then there was an additional request included to refresh the OAuth token and the second request to the first endpoint succeeded. This VCR cassette is incompatible with the new TTL-based authentication approach, where a token is refreshed shortly before expiry, but not based on negative request outcomes.
Introducing a core class for logging that's inspired by the
Storages::TaggedLogging module. Though it aims to natively
support key-value-pairs during logging.
What still needs to be added is a way to temporarily add tags,
i.e. `with_log_tags { ... }`.
NobodysNightmare
force-pushed
the
oauth-client-tokens
branch
from
August 12, 2026 11:17
92a355d to
0069755
Compare
Contributor
Author
|
Follow me to #24726 |
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Previously the fetching and updating of
OAuthClientTokenwas left as an implementation detail of specific integrations, even though the concept ofOAuthClientandOAuthClientTokenwere defined in the core and even their creation is already handled through a core class (theConnectionManager).This PR introduces the
OAuthClients::TokenFetcherthat serves as the new main interface to obtain the access token of anOAuthClientToken. A relevant difference compared to the previous approach is that we refresh access tokens based on their time-to-live (i.e.expires_in), not based on receiving an error response and then retrying.Ticket
https://community.openproject.org/wp/SI-236