Repository navigation
Conversation
| recover | ||
| ? std::unordered_map<std::string, std::string>{{"Authorization", | ||
| "Basic " + | ||
| Base64::Encode( |
There was a problem hiding this comment.
Can we form-encode the ID and secret separately, then join them with : before Base64? For example, a+b should become a%2Bb. A secret-only credential also needs the leading :.
| recover = recover || (expires_at_ != std::chrono::steady_clock::time_point{} && | ||
| expires_at_ <= config_.now()); | ||
| } | ||
| if ((!config_.exchange_enabled || recover) && config_.credential.empty()) { |
There was a problem hiding this comment.
With an empty ID and secret, this skips refresh even when the HTTP client already has an Authorization header. Please keep sending the request in that case. The existing factory test can cover it with "", "".
| EXPECT_FALSE(session_->IsRefreshable()); | ||
| } | ||
|
|
||
| TEST_F(OAuth2ExchangeRefreshTest, CloseSkipsQueuedExchange) { |
There was a problem hiding this comment.
I'd drop this test and CloseWaitsForExchangeAndStopsRetries. We already test closing before a queued refresh and during a failed request. Keep the two final-recovery tests.
|
|
||
| INSTANTIATE_TEST_SUITE_P( | ||
| RecoveryModes, RestCatalogOAuth2RecoveryTest, | ||
| ::testing::Values(OAuth2RecoveryCase{"ExpiredExchange", true, true}, |
There was a problem hiding this comment.
I'd keep only FinalExchange here. The loopback tests already cover both expired-token cases. Move the seventh-attempt client_credentials success case next to StopsAfterHttpRetryBudget.
|
|
||
| INSTANTIATE_TEST_SUITE_P( | ||
| ExchangeModes, RestCatalogOAuth2RefreshTest, | ||
| ::testing::Values(OAuth2RefreshModeCase{"Default", "", "", "", true}, |
There was a problem hiding this comment.
Can we cut this to four cases? Unset, server default, client beats default, server override beats client.
| std::shared_ptr<AuthSession> session_; | ||
| }; | ||
|
|
||
| TEST_P(OAuth2ManagerRefreshTest, CatalogRefreshUsesConfiguredGrant) { |
There was a problem hiding this comment.
The REST catalog tests already check this grant choice. I'd drop this case and keep the child-session tests. They cover inheritance and recovery with the child's own credential.
| auto separator = field.find('='); | ||
| if (separator != std::string::npos) { | ||
| form.emplace(UrlEncoder::Decode(field.substr(0, separator)), | ||
| UrlEncoder::Decode(field.substr(separator + 1))); |
There was a problem hiding this comment.
Can we turn raw + into a space before percent-decoding? The test currently accepts + where the wire value should be %2B.
Honor
token-exchange-enabledfor credential-based catalog and contextualsession refreshes. Add Basic-authenticated recovery for expired tokens and
one final recovery attempt after retries, while preserving session identity
and public API compatibility.
Add regression coverage for refresh, recovery, shutdown, and HTTP authentication.
Validation: 580 tests passed, 1 existing test skipped; pre-commit passed.
Part of #1095.