|
17 | 17 | use Symfony\Component\DependencyInjection\ContainerBuilder;
|
18 | 18 | use Symfony\Component\DependencyInjection\Exception\LogicException;
|
19 | 19 | use Symfony\Component\DependencyInjection\Reference;
|
20 |
| -use Symfony\Component\HttpClient\HttpClient; |
21 | 20 |
|
22 | 21 | /**
|
23 | 22 | * Configures a token handler for decoding and validating an OIDC token.
|
@@ -52,27 +51,13 @@ public function create(ContainerBuilder $container, string $id, array|string $co
|
52 | 51 |
|
53 | 52 | $tokenHandlerDefinition->replaceArgument(0, $algorithmManagerDefinition);
|
54 | 53 |
|
55 |
| - if (!isset($config['jwks_url']) && !isset($config['key'])) { |
56 |
| - throw new LogicException('You should defined key or jwks_url parameter in configuration.'); |
| 54 | + if (!isset($config['key'])) { |
| 55 | + throw new LogicException('You should defined key parameter in configuration.'); |
57 | 56 | }
|
58 | 57 |
|
59 |
| - if (isset($config['jwks_url'])) { |
60 |
| - if (!class_exists(HttpClient::class)) { |
61 |
| - throw new LogicException(sprintf('You cannot use "%s" as the HttpClient component is not installed. Try running "composer require symfony/http-client".', __CLASS__)); |
62 |
| - } |
63 |
| - $httpClient = HttpClient::create(); |
64 |
| - $response = $httpClient->request( |
65 |
| - 'GET', |
66 |
| - $config['jwks_url'] |
67 |
| - ); |
68 |
| - $jwkDefinition = (new ChildDefinition('security.access_token_handler.oidc.jwk_set')) |
69 |
| - ->replaceArgument(0, $response->getContent()); |
70 |
| - } elseif (isset($config['key'])) { |
71 |
| - $jwkDefinition = (new ChildDefinition('security.access_token_handler.oidc.jwk')) |
72 |
| - ->replaceArgument(0, $config['key']); |
73 |
| - } |
74 |
| - |
75 |
| - $tokenHandlerDefinition->replaceArgument(1, $jwkDefinition); |
| 58 | + $tokenHandlerDefinition->replaceArgument(1, (new ChildDefinition('security.access_token_handler.oidc.jwk')) |
| 59 | + ->replaceArgument(0, $config['key']) |
| 60 | + ); |
76 | 61 | }
|
77 | 62 |
|
78 | 63 | public
72F1
function getKey(): string
|
@@ -106,9 +91,6 @@ public function addConfiguration(NodeBuilder $node): void
|
106 | 91 | ->scalarNode('key')
|
107 | 92 | ->info('JSON-encoded JWK used to sign the token (must contain a "kty" key).')
|
108 | 93 | ->end()
|
109 |
| - ->scalarNode('jwks_url') |
110 |
| - ->info('Url to retrieve JWKSet JSON-encoded (must contain a "keys" key).') |
111 |
| - ->end() |
112 | 94 | ->end()
|
113 | 95 | ->end()
|
114 | 96 | ;
|
|
0 commit comments