8000 [Security] OidcTokenHandler support JWKSet by louismariegaborit · Pull Request #51665 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[Security] OidcTokenHandler support JWKSet #51665

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Prev Previous commit
Next Next commit
Fix psalm error
  • Loading branch information
louismariegaborit committed Jan 30, 2024
commit 615b64eaa9e799b29fdd8139972b1ab4d963942f
Original file line number Diff line number Diff line change
Expand Up @@ -25,27 +25,25 @@ final class SignatureAlgorithmFactory
{
public static function create(string $algorithm): AlgorithmInterface
{
$algorithmFqcn = Algorithm::class.'\\'.$algorithm;

switch ($algorithm) {
case 'ES256':
case 'ES384':
case 'ES512':
if (!class_exists(Algorithm::class.'\\'.$algorithm)) {
if (!class_exists($algorithmFqcn)) {
throw new \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));
}

$algorithm = Algorithm::class.'\\'.$algorithm;
break;
case 'RS256':
if (!class_exists(Algorithm::class.'\\'.$algorithm)) {
if (!class_exists($algorithmFqcn)) {
throw new \LogicException(sprintf('You cannot use the "%s" signature algorithm since "web-token/jwt-signature-algorithm-rsa" is not installed. Try running "composer require web-token/jwt-signature-algorithm-rsa".', $algorithm));
}

$algorithm = Algorithm::class.'\\'.$algorithm;
break;
default:
throw new InvalidArgumentException(sprintf('Unsupported signature algorithm "%s". Only ES* and RS256 algorithms are supported. If you want to use another algorithm, create your TokenHandler as a service.', $algorithm));
}

return new $algorithm();
return new $algorithmFqcn();
}
}
0