示例#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());
 }