Пример #1
0
 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
 public function testSetType_lower()
 {
     $jwt = new Jwt($this->claims, $this->secret, $this->header);
     $jwt->setType('jwt');
     $this->assertEquals('jwt', $jwt->getHeader('typ')->get());
 }