Skip to content

Commit fac9e3c

Browse files
authored
feat: Support Configurable Networking PSRs (#166)
1 parent 97ebb4f commit fac9e3c

File tree

1 file changed

+28
-4
lines changed

1 file changed

+28
-4
lines changed

src/Auth0Bundle.php

+28-4
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,30 @@ public function loadExtension(array $config, ContainerConfigurator $container, C
4242
$eventListenerProvider = new Reference($eventListenerProvider);
4343
}
4444

45+
$httpClient = $config['sdk']['http_client'] ?? null;
46+
47+
if (null !== $httpClient && '' !== $httpClient) {
48+
$httpClient = new Reference($httpClient);
49+
}
50+
51+
$httpRequestFactory = $config['sdk']['http_request_factory'] ?? null;
52+
53+
if (null !== $httpRequestFactory && '' !== $httpRequestFactory) {
54+
$httpRequestFactory = new Reference($httpRequestFactory);
55+
}
56+
57+
$httpResponseFactory = $config['sdk']['http_response_factory'] ?? null;
58+
59+
if (null !== $httpResponseFactory && '' !== $httpResponseFactory) {
60+
$httpResponseFactory = new Reference($httpResponseFactory);
61+
}
62+
63+
$httpStreamFactory = $config['sdk']['http_stream_factory'] ?? null;
64+
65+
if (null !== $httpStreamFactory && '' !== $httpStreamFactory) {
66+
$httpStreamFactory = new Reference($httpStreamFactory);
67+
}
68+
4569
$audiences = $config['sdk']['audiences'] ?? [];
4670
$organizations = $config['sdk']['organizations'] ?? [];
4771
$scopes = $config['sdk']['scopes'] ?? [];
@@ -79,11 +103,11 @@ public function loadExtension(array $config, ContainerConfigurator $container, C
79103
->arg('$tokenLeeway', $config['sdk']['token_leeway'] ?? 60)
80104
->arg('$tokenCache', $tokenCache)
81105
->arg('$tokenCacheTtl', $config['sdk']['token_cache_ttl'])
82-
->arg('$httpClient', $config['sdk']['http_client'])
106+
->arg('$httpClient', $httpClient)
83107
->arg('$httpMaxRetries', $config['sdk']['http_max_retries'])
84-
->arg('$httpRequestFactory', $config['sdk']['http_request_factory'])
85-
->arg('$httpResponseFactory', $config['sdk']['http_response_factory'])
86-
->arg('$httpStreamFactory', $config['sdk']['http_stream_factory'])
108+
->arg('$httpRequestFactory', $httpRequestFactory)
109+
->arg('$httpResponseFactory', $httpResponseFactory)
110+
->arg('$httpStreamFactory', $httpStreamFactory)
87111
->arg('$httpTelemetry', $config['sdk']['http_telemetry'])
88112
->arg('$sessionStorage', $sessionStorage)
89113
->arg('$sessionStorageId', $sessionStoragePrefix)

0 commit comments

Comments
 (0)