Exemple #1
0
 /**
  * Overrides OAuth2::setRefreshToken()
  */
 protected function setRefreshToken($oauthToken, $refreshToken, $clientId, $expires, $scope = NULL)
 {
     MiniRefreshToken::getInstance()->create($oauthToken, $refreshToken, $clientId, $expires, $scope);
 }
Exemple #2
0
 /**
  * 根据设备删除Token
  * @param int $deviceId
  */
 public function deleteToken($deviceId)
 {
     $tokenObjects = OTokens::model()->findAll("device_id=:deviceId", array("deviceId" => $deviceId));
     if (isset($tokenObjects)) {
         foreach ($tokenObjects as $tokenObject) {
             $token = $tokenObject["oauth_token"];
             //删除refresh_token
             MiniRefreshToken::getInstance()->deleteToken($token);
             if ($this->hasCache) {
                 //清理一级缓存
                 $key = $this->getCacheKey($token);
                 $this->deleteCache($key);
             }
             //清理数据库记录
             $tokenObject->delete();
         }
     }
 }