/** * @test * * @uses Lcobucci\JWT\Token::__construct * @uses Lcobucci\JWT\Token::hasHeader * @uses Lcobucci\JWT\Claim\Basic * * @covers Lcobucci\JWT\Token::getHeader * @covers Lcobucci\JWT\Token::getHeaderValue */ public function getHeaderMustReturnValueWhenItIsAReplicatedClaim() { $token = new Token(['jti' => new EqualsTo('jti', 1)]); $this->assertEquals(1, $token->getHeader('jti')); }
/** * Validate token * @param Token $token token object * @return bool */ public function verifyToken(Token $token) { $alg = $token->getHeader('alg'); if (empty($this->supportedAlgs[$alg])) { throw new InvalidParamException('Algorithm not supported'); } $signer = Yii::createObject($this->supportedAlgs[$alg]); return $token->verify($signer, $this->key); }