Ejemplo n.º 1
0
 /**
  * Generate and save request token
  *
  * @param int $entityId Token identifier
  * @param string $callbackUrl Callback URL
  * @return $this
  */
 public function createRequestToken($entityId, $callbackUrl)
 {
     $callbackUrl = !empty($callbackUrl) ? $callbackUrl : OauthHelper::CALLBACK_ESTABLISHED;
     $this->setData(array('entity_id' => $entityId, 'type' => self::TYPE_REQUEST, 'token' => $this->_oauthHelper->generateToken(), 'secret' => $this->_oauthHelper->generateTokenSecret(), 'callback_url' => $callbackUrl));
     $this->save();
     return $this;
 }
Ejemplo n.º 2
0
 /**
  * Generate and save access token for a given user type
  *
  * @param int $userType
  * @return $this
  */
 protected function saveAccessToken($userType)
 {
     $this->setUserType($userType);
     $this->setType(self::TYPE_ACCESS);
     $this->setToken($this->_oauthHelper->generateToken());
     $this->setSecret($this->_oauthHelper->generateTokenSecret());
     return $this->save();
 }
Ejemplo n.º 3
0
 public function testGenerateTokenSecret()
 {
     $token = $this->_oauthHelper->generateTokenSecret();
     $this->assertTrue(is_string($token) && strlen($token) === Oauth::LENGTH_TOKEN_SECRET);
 }