コード例 #1
0
ファイル: JwtTest.php プロジェクト: maarky/jwt
 public function testIsValid_true_customValidator()
 {
     $mutableJwt = new MutableJwt($this->claims, $this->secret, $this->header);
     $jwt = new Jwt($mutableJwt->encode(), $this->secret);
     $jwt->addValidator(function () {
         return true;
     });
     $this->assertTrue($jwt->isValid());
 }
コード例 #2
0
ファイル: Jwt.php プロジェクト: maarky/jwt
 public function getMutable() : MutableJwt
 {
     $jwt = new MutableJwt($this->getClaims()->get(), null, $this->getHeaders()->get());
     if (!is_null($this->secret)) {
         $jwt->setSecret($this->getSecret()->get());
     }
     $validators = $this->getValidators();
     if ($validators->isDefined()) {
         $jwt->addValidator(...$validators->get());
     }
     return $jwt;
 }
コード例 #3
0
ファイル: JwtTest.php プロジェクト: maarky/jwt
 public function testSetType_lower()
 {
     $jwt = new Jwt($this->claims, $this->secret, $this->header);
     $jwt->setType('jwt');
     $this->assertEquals('jwt', $jwt->getHeader('typ')->get());
 }