1 | <?php |
||
19 | final class JWTCreator |
||
20 | { |
||
21 | /** |
||
22 | * @var \Jose\EncrypterInterface|null |
||
23 | */ |
||
24 | private $encrypter = null; |
||
25 | |||
26 | /** |
||
27 | * @var \Jose\SignerInterface |
||
28 | */ |
||
29 | private $signer; |
||
30 | |||
31 | /** |
||
32 | * JWTCreator constructor. |
||
33 | * |
||
34 | * @param \Jose\SignerInterface $signer |
||
35 | */ |
||
36 | public function __construct(SignerInterface $signer) |
||
40 | |||
41 | /** |
||
42 | * @param \Jose\EncrypterInterface $encrypter |
||
43 | */ |
||
44 | public function enableEncryptionSupport(EncrypterInterface $encrypter) |
||
48 | |||
49 | /** |
||
50 | * @param mixed $payload |
||
51 | * @param array $signature_protected_headers |
||
52 | * @param \Jose\Object\JWKInterface $signature_key |
||
53 | * |
||
54 | * @return string |
||
55 | */ |
||
56 | public function sign($payload, array $signature_protected_headers, JWKInterface $signature_key) |
||
65 | |||
66 | /** |
||
67 | * @param string $payload |
||
68 | * @param array $encryption_protected_headers |
||
69 | * @param \Jose\Object\JWKInterface $encryption_key |
||
70 | * |
||
71 | * @return string |
||
72 | */ |
||
73 | public function encrypt($payload, array $encryption_protected_headers, JWKInterface $encryption_key) |
||
83 | |||
84 | /** |
||
85 | * @return string[] |
||
86 | */ |
||
87 | public function getSupportedSignatureAlgorithms() |
||
88 | { |
||
89 | return $this->signer->getSupportedSignatureAlgorithms(); |
||
90 | } |
||
91 | |||
92 | /** |
||
93 | * @return string[] |
||
94 | */ |
||
95 | public function getSupportedKeyEncryptionAlgorithms() |
||
99 | |||
100 | /** |
||
101 | * @return string[] |
||
102 | */ |
||
103 | public function getSupportedContentEncryptionAlgorithms() |
||
107 | |||
108 | /** |
||
109 | * @return string[] |
||
110 | */ |
||
111 | public function getSupportedCompressionMethods() |
||
115 | } |
||
116 |