|
9 | 9 | namespace Magento\JwtFrameworkAdapter\Model;
|
10 | 10 |
|
11 | 11 | use Jose\Component\Core\AlgorithmManager;
|
| 12 | +use Jose\Component\Encryption\Algorithm\KeyEncryption\A128GCMKW; |
| 13 | +use Jose\Component\Encryption\Algorithm\KeyEncryption\A128KW; |
| 14 | +use Jose\Component\Encryption\Algorithm\KeyEncryption\A192GCMKW; |
| 15 | +use Jose\Component\Encryption\Algorithm\KeyEncryption\A192KW; |
| 16 | +use Jose\Component\Encryption\Algorithm\KeyEncryption\A256GCMKW; |
| 17 | +use Jose\Component\Encryption\Algorithm\KeyEncryption\A256KW; |
| 18 | +use Jose\Component\Encryption\Algorithm\KeyEncryption\Dir; |
| 19 | +use Jose\Component\Encryption\Algorithm\KeyEncryption\ECDHES; |
| 20 | +use Jose\Component\Encryption\Algorithm\KeyEncryption\ECDHESA128KW; |
| 21 | +use Jose\Component\Encryption\Algorithm\KeyEncryption\ECDHESA192KW; |
| 22 | +use Jose\Component\Encryption\Algorithm\KeyEncryption\ECDHESA256KW; |
| 23 | +use Jose\Component\Encryption\Algorithm\KeyEncryption\PBES2HS256A128KW; |
| 24 | +use Jose\Component\Encryption\Algorithm\KeyEncryption\PBES2HS384A192KW; |
| 25 | +use Jose\Component\Encryption\Algorithm\KeyEncryption\PBES2HS512A256KW; |
| 26 | +use Jose\Component\Encryption\Algorithm\KeyEncryption\RSAOAEP; |
| 27 | +use Jose\Component\Encryption\Algorithm\KeyEncryption\RSAOAEP256; |
12 | 28 |
|
13 | 29 | class JweAlgorithmManagerFactory
|
14 | 30 | {
|
15 |
| - private const ALGOS = [ |
16 |
| - \Jose\Component\Encryption\Algorithm\KeyEncryption\RSAOAEP::class, |
17 |
| - \Jose\Component\Encryption\Algorithm\KeyEncryption\RSAOAEP256::class, |
18 |
| - \Jose\Component\Encryption\Algorithm\KeyEncryption\A128KW::class, |
19 |
| - \Jose\Component\Encryption\Algorithm\KeyEncryption\A192KW::class, |
20 |
| - \Jose\Component\Encryption\Algorithm\KeyEncryption\A256KW::class, |
21 |
| - \Jose\Component\Encryption\Algorithm\KeyEncryption\Dir::class, |
22 |
| - \Jose\Component\Encryption\Algorithm\KeyEncryption\ECDHES::class, |
23 |
| - \Jose\Component\Encryption\Algorithm\KeyEncryption\ECDHESA128KW::class, |
24 |
| - \Jose\Component\Encryption\Algorithm\KeyEncryption\ECDHESA192KW::class, |
25 |
| - \Jose\Component\Encryption\Algorithm\KeyEncryption\ECDHESA256KW::class, |
26 |
| - \Jose\Component\Encryption\Algorithm\KeyEncryption\A128GCMKW::class, |
27 |
| - \Jose\Component\Encryption\Algorithm\KeyEncryption\A192GCMKW::class, |
28 |
| - \Jose\Component\Encryption\Algorithm\KeyEncryption\A256GCMKW::class, |
29 |
| - \Jose\Component\Encryption\Algorithm\KeyEncryption\PBES2HS256A128KW::class, |
30 |
| - \Jose\Component\Encryption\Algorithm\KeyEncryption\PBES2HS384A192KW::class, |
31 |
| - \Jose\Component\Encryption\Algorithm\KeyEncryption\PBES2HS512A256KW::class |
32 |
| - ]; |
33 |
| - |
34 | 31 | /**
|
35 | 32 | * @var AlgorithmProviderFactory
|
36 | 33 | */
|
37 | 34 | private $algorithmProviderFactory;
|
38 | 35 |
|
39 |
| - public function __construct(AlgorithmProviderFactory $algorithmProviderFactory) { |
| 36 | + public function __construct(AlgorithmProviderFactory $algorithmProviderFactory) |
| 37 | + { |
40 | 38 | $this->algorithmProviderFactory = $algorithmProviderFactory;
|
41 | 39 | }
|
42 | 40 |
|
43 | 41 | public function create(): AlgorithmManager
|
44 | 42 | {
|
45 |
| - return new AlgorithmManager($this->algorithmProviderFactory->create(self::ALGOS)->getAvailableAlgorithms()); |
| 43 | + return new AlgorithmManager([ |
| 44 | + new RSAOAEP(), |
| 45 | + new RSAOAEP256(), |
| 46 | + new A128KW(), |
| 47 | + new A192KW(), |
| 48 | + new A256KW(), |
| 49 | + new Dir(), |
| 50 | + new ECDHES(), |
| 51 | + new ECDHESA128KW(), |
| 52 | + new ECDHESA192KW(), |
| 53 | + new ECDHESA256KW(), |
| 54 | + new A128GCMKW(), |
| 55 | + new A192GCMKW(), |
| 56 | + new A256GCMKW(), |
| 57 | + new PBES2HS256A128KW(), |
| 58 | + new PBES2HS384A192KW(), |
| 59 | + new PBES2HS512A256KW(), |
| 60 | + ]); |
46 | 61 | }
|
47 | 62 | }
|
0 commit comments