diff --git a/packages/mango/Jose/CustomClaimChecker.php b/packages/mango/Jose/CustomClaimChecker.php new file mode 100644 index 0000000..1859dae --- /dev/null +++ b/packages/mango/Jose/CustomClaimChecker.php @@ -0,0 +1,29 @@ +value) { + throw new InvalidClaimException('Invalid value.', $this->name, $value); + } + } + + public function supportedClaim(): string + { + return $this->name; + } +} diff --git a/packages/mango/Jose/JWTHandler.php b/packages/mango/Jose/JWTHandler.php index 818ea6c..b65bb2a 100644 --- a/packages/mango/Jose/JWTHandler.php +++ b/packages/mango/Jose/JWTHandler.php @@ -11,7 +11,6 @@ use Jose\Component\Core\Util\JsonConverter; use Jose\Component\Signature\JWSVerifier; use Jose\Component\Signature\Serializer\CompactSerializer as JWSCompactSerializer; -use LogicException; use Psr\Log\LoggerInterface; use RuntimeException; use Symfony\Component\DependencyInjection\Attribute\Autowire; @@ -32,6 +31,7 @@ public function __construct( private ClaimCheckerManager $claimCheckerManager, #[Autowire(service: 'jose.jws_verifier.access_token')] private JWSVerifier $jwsLoader, + #[Autowire(param: 'jose.access_token.mandatory_claims')] private array $mandatoryClaims = [], private ?LoggerInterface $logger = null, private string $userIdClaim = 'sub',