/** * Attempt to authenticate a request * * @param Token $token * @param string $prefix * @return bool */ public function attempt(Token $token, $prefix = Request::PREFIX) { $auth = $this->getAuthParams($prefix); $body = $this->getBodyParams($prefix); $request = new Request($this->method, $this->uri, $body, $auth[$prefix . 'timestamp']); $signature = $request->sign($token, $prefix); foreach ($this->guards as $guard) { $guard->check($auth, $signature, $prefix); } return true; }
/** * Returns auth URL for user to authenticate the application * @param string $perms Permission you need (read, write or delete) * @return string */ public function getAuthUrl($perms = self::AUTH_TYPE_READ) { // if (!$this->frob) { // $this->auth->getFrob(); // } $request = new Request(); $request->setParameter('api_key', $this->getApiKey()); //$request->setParameter('frob', $this->getFrob()); $request->setParameter('perms', $perms); $request->sign($this->getSecret()); return $request->getAuthUrl(); }
public function sign(Request $request) { return $request->sign(this); }