Skip to content

Make the HTTP client replaceable and give it timeouts - #92

Merged
robertlemke merged 1 commit into
mainfrom
feature/replaceable-http-client
Oct 9, 2026
Merged

robertlemke merged 1 commit into
mainfrom
feature/replaceable-http-client

Conversation

@robertlemke

Copy link
Copy Markdown
Member

All requests of this package to the identity provider now go through an HTTP client from HttpClientFactoryInterface: discovery, keys and refresh in OpenIdConnectClient, and code exchange and token requests in its OAuth client. The default factory sets a connect timeout of 5 seconds and a timeout of 10 seconds, configurable with Flownative.OpenIdConnect.Client.httpClient. Previously none of these requests had a limit.

Applications can replace the factory in Objects.yaml, for a proxy or, in tests, for a client which answers without the network. The README describes both.

Resolves: #84

All requests of this package to the identity provider now use an HTTP
client from HttpClientFactoryInterface: discovery, keys and refreshing
identity tokens in OpenIdConnectClient, and exchanging codes and
requesting tokens in its OAuth client. The default factory gives the
client a connect timeout of 5 seconds and a timeout of 10 seconds,
configurable with the setting "httpClient".

Previously, OpenIdConnectClient created a Guzzle client with "new" in
its constructor, without any limit, and the OAuth client used the
default of the OAuth2 package, also without a limit. An identity
provider which didn't answer kept requests, and workers fetching access
tokens, waiting until PHP or the web server gave up.

The factory can be replaced in Objects.yaml, for example to use a
proxy. Tests of applications can replace it with one whose client
answers without the network, instead of filling the caches of this
package with identifiers taken from its internals.

Resolves: #84
@robertlemke
robertlemke force-pushed the feature/replaceable-http-client branch from 611d174 to c00d002 Compare October 9, 2026 12:58
@robertlemke
robertlemke merged commit 51f204d into main Oct 9, 2026
12 checks passed
@robertlemke
robertlemke deleted the feature/replaceable-http-client branch October 9, 2026 13:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Replaceable HTTP client and timeout support

1 participant