Esempio n. 1
0
 /**
  * @param JwtToken $token
  *
  * @throws \InvalidArgumentException
  */
 public function validateToken(JwtToken $token)
 {
     $this->validateHeader($token->getHeader());
     $this->validateClaims($token->getClaims());
     if (!$this->secretLoader) {
         $token->validateSignature($this->secret, $this->getSignatureValidator());
         return;
     }
     $token->validateSignature($this->secretLoader->load($token), $this->getSignatureValidator());
 }
Esempio n. 2
0
 /**
  * @test
  */
 public function willNitFailWhenSignatureValidationIsSuccessful()
 {
     $validator = $this->getMockBuilder('KleijnWeb\\JwtBundle\\Authenticator\\SignatureValidator\\SignatureValidator')->getMockForAbstractClass();
     $token = new JwtToken(self::EXAMPLE_TOKEN);
     $validator->expects($this->once())->method('isValid')->willReturn(true);
     $token->validateSignature('foobar', $validator);
 }