Exemplo n.º 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());
 }
Exemplo n.º 2
0
Arquivo: Jwt.php Projeto: 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;
 }
Exemplo n.º 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());
 }