Skip to content

Commit 4066312

Browse files
Remove jwks_url parameter
1 parent 6e047ba commit 4066312

File tree

3 files changed

+5
-32
lines changed

3 files changed

+5
-32
lines changed

src/Symfony/Bundle/SecurityBundle/CHANGELOG.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ CHANGELOG
55
---
66

77
* Mark class `ExpressionCacheWarmer` as `final`
8-
* Add `jwks_url` option in oidc token handler configuration
98

109
7.0
1110
---

src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/AccessToken/OidcTokenHandlerFactory.php

Lines changed: 5 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
use Symfony\Component\DependencyInjection\ContainerBuilder;
1818
use Symfony\Component\DependencyInjection\Exception\LogicException;
1919
use Symfony\Component\DependencyInjection\Reference;
20-
use Symfony\Component\HttpClient\HttpClient;
2120

2221
/**
2322
* 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
5251

5352
$tokenHandlerDefinition->replaceArgument(0, $algorithmManagerDefinition);
5453

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.');
5756
}
5857

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+
);
7661
}
7762

7863
public function getKey(): string
@@ -106,9 +91,6 @@ public function addConfiguration(NodeBuilder $node): void
10691
->scalarNode('key')
10792
->info('JSON-encoded JWK used to sign the token (must contain a "kty" key).')
10893
->end()
109-
->scalarNode('jwks_url')
110-
->info('Url to retrieve JWKSet JSON-encoded (must contain a "keys" key).')
111-
->end()
11294
->end()
11395
->end()
11496
;

src/Symfony/Bundle/SecurityBundle/Resources/config/security_authenticator_access_token.php

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
use Jose\Component\Core\Algorithm;
1515
use Jose\Component\Core\AlgorithmManager;
1616
use Jose\Component\Core\JWK;
17-
use Jose\Component\Core\JWKSet;
1817
use Jose\Component\Signature\Algorithm\ES256;
1918
use Jose\Component\Signature\Algorithm\ES384;
2019
use Jose\Component\Signature\Algorithm\ES512;
@@ -84,13 +83,6 @@
8483
abstract_arg('signature key'),
8584
])
8685

87-
->set('security.access_token_handler.oidc.jwk_set', JWKSet::class)
88-
->abstract()
89-
->factory([JWKSet::class, 'createFromJson'])
90-
->args([
91-
abstract_arg('signature keys'),
92-
])
93-
9486
->set('security.access_token_handler.oidc.signature', Algorithm::class)
9587
->abstract()
9688
->factory([SignatureAlgorithmFactory::class, 'create'])

0 commit comments

Comments
 (0)