发送给指定客户端
@access protected
@author Zjmainstay
@param  $tabid
@param  $client_id
@param  $logs
@param  $force_client_id
335783
protected function sendToClient($tabid, $client_id, $logs, $force_client_id)
    {
        $logs = [
            'tabid'           => $tabid,
            'client_id'       => $client_id,
            'logs'            => $logs,
            'force_client_id' => $force_client_id,
        ];

        $msg     = @json_encode($logs);
        $address = '/' . $client_id; //将client_id作为地址， server端通过地址判断将日志发布给谁

        $this->send($this->config['host'], $msg, $address);
    }
597105
public function force_login($user_id = '')
	{
		// bail out if we don't have a user
		if (empty($user_id))
		{
			return false;
		}

		// get the user we need to login
		if ( ! $user_id instanceOf \Model\Auth_User)
		{
			$this->user = \Model\Auth_User::query()
				->select(\Config::get('ormauth.table_columns', array()))
				->related('metadata')
				->where('id', '=', $user_id)
				->get_one();
		}
		else
		{
			$this->user = $user_id;
		}

		// did we find it
		if ($this->user and ! $this->user->is_new())
		{
			// store the logged-in user and it's hash in the session
			\Session::set('username', $this->user->username);
			\Session::set('login_hash', $this->create_login_hash());

			// and rotate the session id, we've elevated rights
			\Session::instance()->rotate();

			return true;
		}

		// force a logout
		$this->logout();

		// and signal a failed login
		return false;
	}
599474
public static function pull($config = null, $clientId = null)
    {
        // Return if not enabled
        if (!self::isEnabled($config)) {
            return null;
        }

        $tokens = null;
        $cachePath = self::cachePath($config);
        if (file_exists($cachePath)) {
            // Read from the file
            $cachedToken = file_get_contents($cachePath);
            if ($cachedToken && JsonValidator::validate($cachedToken, true)) {
                $tokens = json_decode($cachedToken, true);
                if ($clientId && is_array($tokens) && array_key_exists($clientId, $tokens)) {
                    // If client Id is found, just send in that data only
                    return $tokens[$clientId];
                } else if ($clientId) {
                    // If client Id is provided, but no key in persisted data found matching it.
                    return null;
                }
            }
        }
        return $tokens;
    }
96314
public static function make(?string $clientId, ?string $clientSecret)
    {
        return (new static(Discovery::client()))
                        ->setClientId($clientId)
                        ->setClientSecret($clientSecret);
    }
880943
public function serverGroupDelete($sgid, $force = FALSE)
  {
    $this->serverGroupListReset();

    $this->execute("servergroupdel", array("sgid" => $sgid, "force" => $force));
  }
612581
public void setClientID(String clientID) {
        if (clientID == null || clientID.isEmpty()) {
            this.clientID = DEFAULT_CLIENT_ID;
            return;
        }
        this.clientID = clientID;
    }
826336
public function load($client_id = null)
	{
		if (!is_null($client_id))
		{
			$client = ClientManager::client($client_id, (! is_numeric($client_id)));
		}
		else
		{
			$client = $this->app['client'];
		}

		if (!$client)
		{
			throw new \InvalidArgumentException(sprintf('Invalid client type of "%s".', $client_id));
		}

		return $this->getTemplate((int)$client->id, $this->style);
	}
409173
public function force_login($user_id = '')
	{
		if (empty($user_id))
		{
			return false;
		}

		$this->user = \DB::select_array(\Config::get('simpleauth.table_columns', array('*')))
			->where_open()
			->where('id', '=', $user_id)
			->where_close()
			->from(\Config::get('simpleauth.table_name'))
			->execute(\Config::get('simpleauth.db_connection'))
			->current();

		if ($this->user == false)
		{
			$this->user = \Config::get('simpleauth.guest_login', true) ? static::$guest_login : false;
			\Session::delete('username');
			\Session::delete('login_hash');
			return false;
		}

		\Session::set('username', $this->user['username']);
		\Session::set('login_hash', $this->create_login_hash());
		return true;
	}
558016
public function setLoginData($loginId = null, $roleId = null, $unitId = null, \DateTime $logoutDate = null)
    {
        $this->loginData = [];

        return $this->updateLoginData($loginId, $roleId, $unitId, $logoutDate);
    }
634602
protected function checkClientCredentials($clientId, $clientSecret = null)
    {
        if (null === $application = $this->app['repo.api-applications']->findByClientId($clientId)) {
            return false;
        }

        if (null === $clientSecret) {
            return true;
        }

        return $application->getClientSecret() === $clientSecret;
    }
402573
public function forceUnbind(string $openid, string $deviceId)
    {
        $params = [
            'device_id' => $deviceId,
            'openid' => $openid,
        ];

        return $this->httpPostJson('device/compel_unbind', $params);
    }
788649
public function getClient($id)
    {
        $response = $this->get('/en/client/edit/id/' . $id);

        $content = trim($this->getBetween((string)$response->getBody(), '<table class="wide">', "</table>"));

        $client = new Client(array(
            'id' => $id,
            'email' => $this->getBetween($content, '<input type="text" name="email" id="email" value="', '">'),
            'first_name' => $this->getBetween($content, '<input type="text" name="first_name" id="first_name" value="', '">'),
            'last_name' => $this->getBetween($content, '<input type="text" name="last_name" id="last_name" value="', '">'),
            'company' => $this->getBetween($content, '<input type="text" name="company" id="company" value="', '">'),
            'address_1' => $this->getBetween($content, '<input type="text" name="address_1" id="address_1" value="', '">'),
            'address_2' => $this->getBetween($content, '<input type="text" name="address_2" id="address_2" value="', '">'),
            'country' => $this->getBetweenReverse($content, '<option value="', '" selected="selected">'),
            'city' => $this->getBetween($content, '<input type="text" name="city" id="city" value="', '">'),
            'state' => $this->getBetween($content, '<input type="text" name="state" id="state" value="', '">'),
            'zip' => $this->getBetween($content, '<input type="text" name="zip" id="zip" value="', '">'),
            'phone_cc' => $this->getBetween($content, '<input type="text" name="phone_cc" id="phone_cc" value="', '">'),
            'phone' => $this->getBetween($content, '<input type="text" name="phone" id="phone" value="', '">'),
        ));

        return $client;
    }
1133921
private void removeClientId(String clientId) {
        //Sometimes the client Id will be null. For instance in the case QueueConnectionFactory, there is no default client Id specified in metatype.xml. 
        if (clientId == null)
            return; //do nothing

        ConcurrentHashMap<String, Integer> clientIdTable = JmsFactoryFactoryImpl.getClientIdTable();

        if (clientIdTable.containsKey(clientId)) {
            int referenceCount = clientIdTable.get(clientId).intValue();
            if (referenceCount == 1) {
                clientIdTable.remove(clientId);
            } else {
                clientIdTable.put(clientId, clientIdTable.get(clientId).intValue() - 1);
            }
        }
    }
1374867
public function removeClientUser($client_id, $user_id)
    {
        $sql    = 'DELETE from %s where client_id = :client_id and user_id = :user_id';
        $sql    = sprintf($sql, $this->config['client_user_table']);
        $params = array_map('trim', compact('client_id', 'user_id'));

        return $this->db->prepare($sql)->execute($params);
    }
217358
public function getClientDetails($client_id)
    {
        $result = $this->getObjectByType('client_table',$client_id);

        return is_null($result) ? false : $result;
    }
315924
public function getClientId($binding_index)
    {
        $binding = $this->getBinding();
        return array_key_exists('clientId', $binding[$binding_index]) ? $binding[$binding_index]['clientId'] : null;
    }
969360
public function delete($id = null)
	{
		if ($id === null) {
			foreach ($this->getLogs() as $log) {
				unlink($this->path . $log->name);
			}
		} elseif (is_array($id)) {
			foreach ($id as $key) {
				unlink($this->path . $this->getLog($key)->name);
			}
		} else {
			unlink($this->path . $this->getLog((string) $id)->name);
		}
		$this->logs = null;
	}