src/ImboClient/EventSubscriber/AccessToken.php
public function appendAccessToken(Event $event) {
        $command = $event['command'];

        switch ($command->getName()) {
            case 'GetResourceGroup':
            case 'GetResourceGroups':
            case 'GetAccessControlRule':
            case 'GetAccessControlRules':
            case 'GetUserInfo':
            case 'GetImages':
            case 'GetImageProperties':
            case 'GetMetadata':
                $request = $command->getRequest();

                // Generate an access token
                $accessToken = $this->getAccessToken(urldecode($request->getUrl()), $request->getClient()->getConfig('privateKey'));

                // Add as query parameter
                $request->getQuery()->set('accessToken', $accessToken);
                break;
        }
    }
public function appendAccessToken(Event $event) {
        $command = $event['command'];

        switch ($command->getName()) {
            case 'GetResourceGroup':
            case 'GetResourceGroups':
            case 'GetAccessControlRule':
            case 'GetAccessControlRules':
            case 'GetUserInfo':
            case 'GetImages':
            case 'GetImageProperties':
            case 'GetMetadata':
                $request = $command->getRequest();

                // Generate an access token
                $accessToken = $this->getAccessToken(urldecode($request->getUrl()), $request->getClient()->getConfig('privateKey'));

                // Add as query parameter
                $request->getQuery()->set('accessToken', $accessToken);
                break;
        }
    }
public function appendAccessToken ( Event $ event ) { $ command = $ event [ 'command' ] ; switch ( $ command -> getName ( ) ) { case 'GetResourceGroup' : case 'GetResourceGroups' : case 'GetAccessControlRule' : case 'GetAccessControlRules' : case 'GetUserInfo' : case 'GetImages' : case 'GetImageProperties' : case 'GetMetadata' : $ request = $ command -> getRequest ( ) ; // Generate an access token $ accessToken = $ this -> getAccessToken ( urldecode ( $ request -> getUrl ( ) ) , $ request -> getClient ( ) -> getConfig ( 'privateKey' ) ) ; // Add as query parameter $ request -> getQuery ( ) -> set ( 'accessToken' , $ accessToken ) ; break ; } }
Append an access token query parameter to the request URL

@param Event $event The current event
Append an access token query parameter to the request URL