eb2d7bd598ae68e1b857b41907d7b3adc5f543cb
[GitHub/WoltLab/WCF.git] /
1 <?php
2
3 declare(strict_types=1);
4
5 namespace Jose\Component\NestedToken;
6
7 use Jose\Component\Encryption\JWELoaderFactory;
8 use Jose\Component\Signature\JWSLoaderFactory;
9
10 class NestedTokenLoaderFactory
11 {
12 public function __construct(
13 private readonly JWELoaderFactory $jweLoaderFactory,
14 private readonly JWSLoaderFactory $jwsLoaderFactory
15 ) {
16 }
17
18 /**
19 * This method creates a Nested Token Loader with the given encryption/signature algorithms, serializers,
20 * compression methods and header checkers.
21 *
22 * @param array<string> $jweSerializers
23 * @param array<string> $keyEncryptionAlgorithms
24 * @param array<string> $contentEncryptionAlgorithms
25 * @param array<string> $compressionMethods
26 * @param array<string> $jweHeaderCheckers
27 * @param array<string> $jwsSerializers
28 * @param array<string> $signatureAlgorithms
29 * @param array<string> $jwsHeaderCheckers
30 */
31 public function create(
32 array $jweSerializers,
33 array $keyEncryptionAlgorithms,
34 array $contentEncryptionAlgorithms,
35 array $compressionMethods,
36 array $jweHeaderCheckers,
37 array $jwsSerializers,
38 array $signatureAlgorithms,
39 array $jwsHeaderCheckers
40 ): NestedTokenLoader {
41 $jweLoader = $this->jweLoaderFactory->create(
42 $jweSerializers,
43 $keyEncryptionAlgorithms,
44 $contentEncryptionAlgorithms,
45 $compressionMethods,
46 $jweHeaderCheckers
47 );
48 $jwsLoader = $this->jwsLoaderFactory->create($jwsSerializers, $signatureAlgorithms, $jwsHeaderCheckers);
49
50 return new NestedTokenLoader($jweLoader, $jwsLoader);
51 }
52 }