Beispiel #1
0
 public function testIsAPICallAuthorized()
 {
     $builders = $this->buildData();
     $this->assertTrue(Session::isAPICallAuthorized('*****@*****.**', '1829cc1b13f920a05fb201e8d2a9e4dc58b669b1'));
     $this->assertFalse(Session::isAPICallAuthorized('*****@*****.**', '1829cc1b13f920a05fb201e8d2a9e4dc58b669b2'));
     $this->assertFalse(Session::isAPICallAuthorized('*****@*****.**', null));
     $this->assertFalse(Session::isAPICallAuthorized(null, '1829cc1b13f920a05fb201e8d2a9e4dc58b669b1'));
     $this->assertFalse(Session::isAPICallAuthorized(null, null));
 }
 /**
  * Checks the username and API secret from the request, and returns true if they match, and are both valid.
  * @return boolean Are the provided username and API secret parameters valid?
  */
 private function isAPICallValid()
 {
     $logged_in_username = $this->getLoggedInUser();
     $api_secret = self::getAPISecretFromRequest();
     return Session::isAPICallAuthorized($logged_in_username, $api_secret);
 }