Exemplo n.º 1
0
 /**
  * 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;
 }
Exemplo n.º 2
0
 /**
  * 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();
 }
Exemplo n.º 3
0
 public function sign(Request $request)
 {
     return $request->sign(this);
 }