Пример #1
0
 /**
  * @param \Phpro\MvcAuthToken\Token $token
  */
 protected function mockToken($token)
 {
     $token->getNonce()->willReturn('nonce');
     $token->getTimestamp()->willReturn(12345);
     $this->setToken($token);
 }
Пример #2
0
 /**
  * @param Token $token
  *
  * @return bool
  */
 public function validateToken(Token $token)
 {
     $adapter = $this->getAdapter();
     if (!$adapter->validateTimestamp($token->getTimestamp())) {
         return false;
     }
     if (!$adapter->validateNonce($token->getNonce())) {
         return false;
     }
     if (!$adapter->validateToken($token)) {
         return false;
     }
     return true;
 }