/**
  * @param string            $uid
  * @param int               $timestamp Unix Timestamp
  * @param string            $signature
  * @param ResponseInterface $response
  *
  * @throws InvalidTimestampException
  * @throws InvalidUidSignatureException
  *
  * @return bool
  */
 private function assertUid($uid, $timestamp, $signature, ResponseInterface $response)
 {
     if (!$this->signature->checkTimestamp($timestamp)) {
         throw new InvalidTimestampException($timestamp, $response);
     }
     $expected = $this->signature->getUidSignature($uid, $timestamp, $this->secret);
     if ($signature !== $expected) {
         throw new InvalidUidSignatureException($uid, $expected, $signature, $response);
     }
     return true;
 }
Beispiel #2
0
 /**
  * @dataProvider getUidSignatures
  *
  * @param string $uid
  * @param int    $time
  * @param string $secret
  * @param string $expected
  */
 public function testGetUidSignature($uid, $time, $secret, $expected)
 {
     static::assertEquals($expected, $this->validator->getUidSignature($uid, $time, $secret));
 }