public function validate(Vanilla\Request $request, Vanilla\User $user = null, Vanilla\Config $config = null)
 {
     $signature = md5($request->getTimestamp() . $config->getSecret());
     if ($request->getSignature() != $signature) {
         return new Response\InvalidSignature($request);
     }
 }
 public function validate(Vanilla\Request $request, Vanilla\User $user = null, Vanilla\Config $config = null)
 {
     if ($request->getClientID() !== $config->getClientID()) {
         $clientID = $request->getClientID();
         $clientResponse = new Response\InvalidClientID($request);
         $clientResponse->setClientID($clientID);
         return $clientResponse;
     }
 }
Exemplo n.º 3
0
 public function testSetJsTimeout()
 {
     $config = new Config(['clientID' => 1234, 'secret' => 'abcde', 'jsTimeout' => 2]);
     $this->assertEquals(2, $config->getJsTimeout());
 }
 public function validate(Vanilla\Request $request, Vanilla\User $user = null, Vanilla\Config $config = null)
 {
     if (time() - $request->getTimestamp() > $config->getJsTimeout()) {
         return new Response\ExpiredTimestamp($request);
     }
 }