Debian Codegraph @

lib/3rdParty/composer/facile-it/php-jose-verifier/src/Internal/Checker/AzpChecker.php

raw symbols SCIP
1 <?php
2
3 declare(strict_types=1);
4
5 namespace Facile\JoseVerifier\Internal\Checker;
6
7 use Jose\Component\Checker\ClaimChecker;
8 use Jose\Component\Checker\InvalidClaimException;
9
10 use function sprintf;
11
12 /**
13 * @internal
14 */
15 final class AzpChecker implements ClaimChecker
16 {
17 private const CLAIM_NAME = 'azp';
18
19 private string $azp;
20
21 public function __construct(string $azp)
22 {
23 $this->azp = $azp;
24 }
25
26 /**
27 * @param mixed $value
28 *
29 * @throws InvalidClaimException
30 */
31 public function checkClaim($value): void
32 {
33 if ($value !== $this->azp) {
34 throw new InvalidClaimException(sprintf('azp must be the client_id, expected %s, got: %s', $this->azp, (string) $value), self::CLAIM_NAME, $value);
35 }
36 }
37
38 public function supportedClaim(): string
39 {
40 return self::CLAIM_NAME;
41 }
42 }