You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feature symfony#53682 [Security] Support RSA algorithm signature for OIDC tokens (Spomky)
This PR was merged into the 7.1 branch.
Discussion
----------
[Security] Support RSA algorithm signature for OIDC tokens
| Q | A
| ------------- | ---
| Branch? | 7.1
| Bug fix? | no
| New feature? | yes
| Deprecations? | no
| Issues |
| License | MIT
Add support for RSA signature algorithm for OidcTokenHandler.
Amazon Cognito uses RS256 algorithm for its tokens.
Commits
-------
3109350 [Security] Support multiple signature algorithms and JWK/JWKSet for OIDC tokens
* Configures a token handler for decoding and validating an OIDC token.
@@ -31,22 +31,15 @@ public function create(ContainerBuilder $container, string $id, array|string $co
31
31
->replaceArgument(4, $config['claim'])
32
32
);
33
33
34
-
if (!ContainerBuilder::willBeAvailable('web-token/jwt-core', Algorithm::class, ['symfony/security-bundle'])) {
35
-
thrownewLogicException('You cannot use the "oidc" token handler since "web-token/jwt-core" is not installed. Try running "composer require web-token/jwt-core".');
34
+
if (!ContainerBuilder::willBeAvailable('web-token/jwt-library', Algorithm::class, ['symfony/security-bundle'])) {
35
+
thrownewLogicException('You cannot use the "oidc" token handler since "web-token/jwt-library" is not installed. Try running "composer require web-token/jwt-library".');
->info('Claim which contains the user identifier (e.g.: sub, email..).')
@@ -72,14 +96,23 @@ public function addConfiguration(NodeBuilder $node): void
72
96
->arrayNode('issuers')
73
97
->info('Issuers allowed to generate the token, for validation purpose.')
74
98
->isRequired()
75
-
->prototype('scalar')->end()
99
+
->scalarPrototype()->end()
76
100
->end()
77
-
->scalarNode('algorithm')
101
+
->arrayNode('algorithm')
78
102
->info('Algorithm used to sign the token.')
103
+
->setDeprecated('symfony/security-bundle', '7.1', 'The "%node%" option is deprecated and will be removed in 8.0. Use the "algorithms" option instead.')
104
+
->end()
105
+
->arrayNode('algorithms')
106
+
->info('Algorithms used to sign the token.')
79
107
->isRequired()
108
+
->scalarPrototype()->end()
80
109
->end()
81
110
->scalarNode('key')
82
111
->info('JSON-encoded JWK used to sign the token (must contain a "kty" key).')
112
+
->setDeprecated('symfony/security-bundle', '7.1', 'The "%node%" option is deprecated and will be removed in 8.0. Use the "keyset" option instead.')
113
+
->end()
114
+
->scalarNode('keyset')
115
+
->info('JSON-encoded JWKSet used to sign the token (must contain a list of valid keys).')
if (!class_exists(Algorithm::class.'\\'.$algorithm)) {
33
-
thrownew \LogicException(sprintf('You cannot use the "%s" signature algorithm since "web-token/jwt-signature-algorithm-ecdsa" is not installed. Try running "composer require web-token/jwt-signature-algorithm-ecdsa".', $algorithm));
34
-
}
35
-
36
-
$algorithm = Algorithm::class.'\\'.$algorithm;
37
-
38
-
returnnew$algorithm();
39
-
}
40
-
41
-
thrownewInvalidArgumentException(sprintf('Unsupported signature algorithm "%s". Only ES* algorithms are supported. If you want to use another algorithm, create your TokenHandler as a service.', $algorithm));
->deprecate('symfony/security-http', '7.1', 'The "%service_id%" service is deprecated. Please use "security.access_token_handler.oidc.jwkset" instead')
0 commit comments