Inheritance: implements JsonSerializable
コード例 #1
0
 public function testValidSignature()
 {
     $algorithmParameter = $this->getMockBuilder('Emarref\\Jwt\\HeaderParameter\\Algorithm')->getMock();
     $algorithmParameter->expects($this->once())->method('getValue')->will($this->returnValue('foo'));
     $this->header->expects($this->once())->method('findParameterByName')->with(HeaderParameter\Algorithm::NAME)->will($this->returnValue($algorithmParameter));
     $this->encryption->expects($this->once())->method('getAlgorithmName')->will($this->returnValue('foo'));
     $this->encryption->expects($this->once())->method('verify')->will($this->returnValue(true));
     $this->signer->expects($this->once())->method('getUnsignedValue')->will($this->returnValue('bar'));
     $this->token->expects($this->once())->method('getSignature')->will($this->returnValue('bar'));
     $verifier = new EncryptionVerifierStub($this->encryption, $this->encoder, $this->signer);
     $verifier->verify($this->token);
 }
コード例 #2
0
ファイル: Token.php プロジェクト: emarref/jwt
 /**
  * @param HeaderParameter\ParameterInterface $parameter
  * @param bool                               $critical
  */
 public function addHeader(HeaderParameter\ParameterInterface $parameter, $critical = false)
 {
     $this->header->setParameter($parameter, $critical);
 }