Ejemplo n.º 1
0
 /**
  * Overrides OAuth2::setAuthCode().
  */
 protected function setAuthCode($code, $client_id, $redirect_uri, $expires, $scope = NULL)
 {
     $consumer = Doctrine::getTable('sfOauthServerConsumer')->findOneByConsumerKey($client_id);
     if (!$consumer) {
         throw new OAuthException('Invalid Request');
     }
     $oauthCode = new sfOauthServerRequestToken();
     $oauthCode->setToken($code);
     $oauthCode->setConsumerId($consumer->getId());
     if ($redirect_uri == NULL) {
         $redirect_uri = $consumer->getCallBack();
     }
     $oauthCode->setCallBack($redirect_uri);
     $oauthCode->setUserId($this->user_id);
     $oauthCode->setExpires($expires);
     $oauthCode->setScope($scope);
     $oauthCode->setProtocole(2);
     $oauthCode->save();
 }
Ejemplo n.º 2
0
 function new_request_token($consumer, $callback = null)
 {
     $c = Doctrine::getTable('sfOauthServerConsumer')->findOneByConsumerKey($consumer->key);
     $key = md5(time());
     $secret = time() + time();
     $token = new OAuthToken($key, md5(md5($secret)));
     $token = new sfOauthServerRequestToken();
     $token->setToken($key);
     $token->setSecret(md5(md5($secret)));
     $token->setConsumer($c);
     $token->setScope($c->getScope());
     $token->save();
     $token = new OAuthToken($token->getToken(), $token->getSecret());
     return $token;
 }