signer = $signer; $this->key = $key; } public function assert(Token $token) { if ($token->headers()->get('alg') !== $this->signer->getAlgorithmId()) { throw new ConstraintViolation('Token signer mismatch'); } if (! $this->signer->verify((string) $token->signature(), $token->getPayload(), $this->key)) { throw new ConstraintViolation('Token signature mismatch'); } } }