Check the client authentication token for all commands except authentication

@param Event $event
341713
public function onClientCommandCreate(\Guzzle\Common\Event $event)
    {
        $command = $event['command'];
        if(get_class($command) != 'Guzzle\Openstack\Identity\Command\Authenticate'){
            if($event['client']->getToken() == null){
                throw new OpenstackException('Unauthenticated');
            }
        }
    }
776725
public function beforePrepare(Event $event)
	{
		$operation = $event['command']->getOperation();
		$client = $event['command']->getClient();

		if ($operation->hasParam('collection') === false) return;
		if (is_null($client->getCollectionName())) return;

		$operation->getParam('collection')->setDefault($client->getCollectionName());
		$operation->getParam('collection')->setStatic(true);

	}
1304994
public function onRequestCreate(Event $event)
    {
        $client = $event['client'];
        $token = $client->getToken();
        
        $event['request']->setHeader('X-Auth-Token', $token);
    }
137386
public function onEndRequest($event)
    {
        if (!$this->_ended) {
            $this->_ended = true;
            $this->raiseEvent('endRequest', $event);
        }
    }
1318852
public function doAuth(EventInterface $event)/*# : bool */
    {
        /* @var ResultInterface $result */
        $result = $event->getParam('result');
        $path = $result->getPath();

        if (!isset($_SESSION['authed']) && '/user/' === substr($path, 0, 6)) {
            $result->setStatus(Status::UNAUTHORIZED);
            return false;
        }
        return true;
    }
434342
public function onBeforeLoginPerson(AnEvent $event)
    {
        $credentials = $event->credentials;

        if (! $this->_canPerform()) {
            return false;
        }

        if (isset($credentials['username'])) {
            $this->_createToken($credentials['username']);
        }
    }
814291
public function handle($event)
    {
        $guard = null;

        // We'll retrieve the auth guard if available.
        if (property_exists($event, 'guard')) {
            $guard = $event->guard;
        }

        // Before we bind the users LDAP model, we will verify they are using
        // the Adldap authentication provider, and the required trait.
        if ($this->isUsingAdldapProvider($guard) && $this->canBind($event->user)) {
            $event->user->setLdapUser(
                Resolver::byModel($event->user)
            );
        }
    }
751995
protected function ensureCorrectUser(Event $event, $command)
    {
        return $event->user && ! windows_os() ? 'sudo -u '.$event->user.' -- sh -c \''.$command.'\'' : $command;
    }
637271
public static function setPermissions(Event $event)
	{
		if ('WIN' === strtoupper(substr(PHP_OS, 0, 3))) {
			$event->getIO()->write('<info>No permissions setup is required on Windows.</info>');
			return;
		}
		$event->getIO()->write('Setting up permissions.');
		/*		try {
					self::setPermissionsSetfacl($event);
					return;
				} catch (\Exception $setfaclException) {
					$event->getIO()->write(sprintf('<error>%s</error>', $setfaclException->getMessage()));
					$event->getIO()->write('<info>Trying chmod...</info>');
				}*/
		try {
			self::setPermissionsChmod($event);
			return;
		} catch (\Exception $chmodException) {
			$event->getIO()->write(sprintf('<error>%s</error>', $chmodException->getMessage()));
		}
	}
151082
public function beforeAction($event)
    {
        if ($this->checkIsMutexAction($event->action->id)) {
            $mutexName = $this->composeMutexName($event->action->id);
            if (!$this->getMutex()->acquire($mutexName)) {
                echo "Execution terminated: command is already running.\n";
                $event->isValid = false;

                return false;
            }
        }
    }
1009018
function onEvent($event)
    {
        if (!isset($event->data[0]['id'])) {
            throw new ClientError('Invalid event data, payment id not found.');
        }

        call_user_func($this->callback, $this->service->get($event->data[0]['id']));
    }
566098
public function handle(Authenticating $event)
    {
        $username = $this->getPrefix().$event->username.$this->getSuffix();

        Log::info("User '{$event->user->getCommonName()}' is authenticating with username: '{$username}'");
    }
713807
private function checkPermission(ActionEvent $event)
    {
        $environment = $event->getEnvironment();

        if (true === $environment->getDataDefinition()->getBasicDefinition()->isEditable()) {
            return true;
        }

        $inputProvider = $environment->getInputProvider();

        $event->setResponse(
            \sprintf(
                '<div style="text-align:center; font-weight:bold; padding:40px;">
                    You have no permission for edit model %s.
                </div>',
                ModelId::fromSerialized($inputProvider->getParameter('id'))->getSerialized()
            )
        );

        return false;
    }
997300
public function handle(GetResponseEvent $event)
    {
        $request = $event->getRequest();
        if ($this->securityContext->getToken() instanceof TokenInterface && $this->securityContext->getToken()->isAuthenticated()) {
            return;
        }

        if (!($accessToken = $request->get('access_token'))) {
            throw new ClientAccessDeniedHttpException();
        }

        $token = $this->authenticationManager->authenticate(OAuth2Token::create($accessToken));
        $this->securityContext->setToken($token);
    }
1359802
function onSignInWithCustomToken(event) {
  // The token can be directly specified on the html element.
  var token = $('#user-custom-token').val();

  auth.signInWithCustomToken(token)
      .then(onAuthUserCredentialSuccess, onAuthError);
}
532339
public function onPostUpdateCmd(Event $event)
    {
        $this->bridgeFactory->createBridge($event->getIO())
            ->update($event->getComposer());
    }
639308
public function onCommandAfterPrepare(Event $event) {

        $command = $event['command'];
        $bucket = $command['Bucket'];
        $request = $command->getRequest();
        if ($command->getName() == 'ListBuckets')
        {
            if ($this->ipport != null) {
                $request->setHost($this->ipport);
                $request->setHeader('Host', 'service.cos.myqcloud.com');
            } else if ($this->endpoint != null) {
                $request->setHost($this->endpoint);
                $request->setHeader('Host', 'service.cos.myqcloud.com');
            }
            else {

                $request->setHost('service.cos.myqcloud.com');
            }
            return ;
        }
        if ($key = $command['Key']) {
            // Modify the command Key to account for the {/Key*} explosion into an array
            if (is_array($key)) {
                $command['Key'] = $key = implode('/', $key);
            }
        }
        $request->setHeader('Date', gmdate('D, d M Y H:i:s T'));
        $request->setPath(preg_replace("#^/{$bucket}#", '', $request->getPath()));

        if ($this->appId != null && endWith($bucket,'-'.$this->appId) == False)
        {
            $bucket = $bucket.'-'.$this->appId;
        }
//        $request->setPath(urldecode($request->getPath()));
        $request->getParams()->set('bucket', $bucket)->set('key', $key);

        $realHost = $bucket. '.' . $request->getHost();
        if($this->ipport != null) {
            $request->setHost($this->ipport);
            $request->setHeader('Host', $realHost);
        } else {
            if($this->endpoint != null) {
                $tmp = $bucket. '.' . $this->endpoint;
                $request->setHost($tmp);
            } else {
                $request->setHost($realHost);
            }
        }
        if (!$bucket) {
            $request->getParams()->set('cos.resource', '/');
        } else {
            // Bucket style needs a trailing slash
            $request->getParams()->set(
                'cos.resource',
                '/' . rawurlencode($bucket) . ($key ? ('/' . Client::encodeKey($key)) : '/')
            );
        }
    }