1 | <?php |
||
21 | abstract class AbstractBuilder |
||
22 | { |
||
23 | /** |
||
24 | * @var JWT |
||
25 | */ |
||
26 | protected $jwt; |
||
27 | |||
28 | /** |
||
29 | * @var JoseAlgorithm[] |
||
30 | */ |
||
31 | protected $algorithms = []; |
||
32 | |||
33 | public function __construct() |
||
47 | |||
48 | public function payload(array $payload): self |
||
55 | |||
56 | public function iss(string $iss, bool $inHeader = false): self |
||
60 | |||
61 | public function sub(string $sub, bool $inHeader = false): self |
||
65 | |||
66 | public function aud(string $aud, bool $inHeader = false): self |
||
73 | |||
74 | public function jti(string $jti, bool $inHeader = false): self |
||
78 | |||
79 | public function exp(int $exp, bool $inHeader = false): self |
||
83 | |||
84 | public function iat(?int $iat = null, bool $inHeader = false): self |
||
90 | |||
91 | public function nbf(?int $nbf = null, bool $inHeader = false): self |
||
97 | |||
98 | /** |
||
99 | * @param Algorithm\SignatureAlgorithm|string $alg |
||
100 | * |
||
101 | * @throws InvalidArgumentException if the algorithm is not a string or an instance of Jose\Component\Core\Algorithm |
||
102 | */ |
||
103 | public function alg($alg): self |
||
122 | |||
123 | public function cty(string $cty): self |
||
127 | |||
128 | public function typ(string $typ): self |
||
132 | |||
133 | public function crit(array $crit): self |
||
137 | |||
138 | /** |
||
139 | * @param mixed $value |
||
140 | */ |
||
141 | public function claim(string $key, $value, bool $inHeader = false): self |
||
151 | |||
152 | /** |
||
153 | * @param mixed $value |
||
154 | */ |
||
155 | public function header(string $key, $value): self |
||
162 | |||
163 | abstract protected function getAlgorithmMap(): array; |
||
164 | } |
||
165 |