Exemplo n.º 1
0
 public function testGetMutable_validators()
 {
     $jwt = new Jwt($this->srcJwt, $this->secret);
     $validators = [function () {
         return true;
     }, function () {
         return false;
     }];
     $jwt->addValidator(...$validators);
     $mutable = $jwt->getMutable();
     $this->assertEquals($validators, $mutable->getValidators()->get());
 }
Exemplo n.º 2
0
Arquivo: Jwt.php Projeto: maarky/jwt
 public function getImmutable() : ImmutableJwt
 {
     $jwt = new ImmutableJwt($this->encode());
     if (!is_null($this->secret)) {
         $jwt->setSecret($this->getSecret()->get());
     }
     $validators = $this->getValidators();
     if ($validators->isDefined()) {
         $jwt->addValidator(...$validators->get());
     }
     $jwt->trusted = false;
     return $jwt;
 }