Add http_client_options for per-provider HTTP timeout/proxy/verify#31
Conversation
Forwards the league/oauth2-client-whitelisted Guzzle options (timeout, proxy, verify) through bundle configuration. Closes the long-standing inability to bound HTTP requests to the IdP. Additive only — existing config continues to work unchanged. README adds a short note explaining why the stack uses Guzzle rather than Symfony HttpClient (league/oauth2-client hard-types its httpClient as GuzzleHttp\ClientInterface). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #31 +/- ##
===========================================
Coverage 100.00% 100.00%
- Complexity 56 57 +1
===========================================
Files 9 9
Lines 248 268 +20
===========================================
+ Hits 248 268 +20
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| // Block must either be absent or empty so nothing leaks into Guzzle. | ||
| $this->assertSame([], $providerOptions['http_client_options'] ?? []); |
There was a problem hiding this comment.
If i understand the code modifications correctly this should never be empty but always absent.
There was a problem hiding this comment.
Changed assert, added comment
| Only the keys whitelisted by `league/oauth2-client` are forwarded: `timeout`, | ||
| `proxy`, and `verify` (the last only when `proxy` is set). |
There was a problem hiding this comment.
I read this as: non-whitelisted keys are stripped. But, according to testHttpClientOptionsRejectsUnknownKey the configurations actually throws an error. Am i misunderstanding?
There was a problem hiding this comment.
Attempted to clairy
Drop the `?? []` fallback that masked the difference between an absent key and an empty array. Per the schema (no defaultValue on the arrayNode), an omitted input must produce no key at all. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The previous wording read as if league silently strips non-whitelisted keys. The bundle config rejects them up front with InvalidConfigurationException at container compile time. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Summary
http_client_optionsblock (timeout,proxy,verify) forwarded to the underlying Guzzle HTTP client used by league/oauth2-clienthttpClientasGuzzleHttp\ClientInterface)Backward compatibility
Additive only. No existing config keys, signatures, defaults, or dependencies change. Targets the next minor (4.2.0).
Test plan
task test— 51 tests passtask analyze:php— phpstan max level, no errorstask lint— php-cs-fixer, composer normalize, markdown, yaml all cleantask test:matrix— all 6 combinations (PHP 8.3/8.4/8.5 × prefer-lowest/prefer-stable) passhttp_client_options.timeout: 0.001and verify aConnectExceptionfires rather than a long hang🤖 Generated with Claude Code