1 | <?php |
||
20 | final class AudienceChecker implements ClaimChecker, HeaderChecker |
||
21 | { |
||
22 | private const CLAIM_NAME = 'aud'; |
||
23 | |||
24 | /** |
||
25 | * @var bool |
||
26 | */ |
||
27 | private $protectedHeader = false; |
||
28 | |||
29 | /** |
||
30 | * @var string |
||
31 | */ |
||
32 | private $audience; |
||
33 | |||
34 | public function __construct(string $audience, bool $protectedHeader = false) |
||
35 | { |
||
36 | $this->audience = $audience; |
||
37 | $this->protectedHeader = $protectedHeader; |
||
38 | } |
||
39 | |||
40 | /** |
||
41 | * {@inheritdoc} |
||
42 | */ |
||
43 | public function checkClaim($value): void |
||
47 | |||
48 | /** |
||
49 | * {@inheritdoc} |
||
50 | */ |
||
51 | public function checkHeader($value): void |
||
55 | |||
56 | public function supportedClaim(): string |
||
60 | |||
61 | public function supportedHeader(): string |
||
65 | |||
66 | public function protectedHeaderOnly(): bool |
||
70 | |||
71 | /** |
||
72 | * @param mixed $value |
||
73 | * |
||
74 | * @throws InvalidClaimException if the claim is invalid |
||
75 | * @throws InvalidHeaderException if the header is invalid |
||
76 | */ |
||
77 | private function checkValue($value, string $class): void |
||
89 | } |
||
90 |