Client request accessor

@return ClientRequests
968533
public function clients()
    {
        if (is_null($this->clientRequests)) {
            $this->clientRequests = new ClientRequests($this->client);
        }

        return $this->clientRequests;
    }
1250647
protected function getAccessToken()
    {
        switch ($this->grant) {
            case 'provided_token':
                return $this->token;

            case 'client_credentials':
                return $this->getFrameworkBridge()->getClientToken();

            case 'authorization_code':
                $user = $this->getFrameworkBridge()->getCurrentUser();

                if (! $user) {
                    return null;
                }

                return $user->getOAuthToken();

            default:
                throw new \Exception('Unsupported grant type. Check $this->grant.');
        }
    }
14095
public function getAccessesAsArray()
    {

        // initialize the array for the accesses
        $accesses = array();

        // iterate over the access nodes and sort them into an array
        /** @var \AppserverIo\Appserver\Core\Api\Node\AccessNode $accessNode */
        foreach ($this->getAccesses() as $accessNode) {
            $accesses[$accessNode->getType()][] = $accessNode->getParamsAsArray();
        }

        // return the array
        return $accesses;
    }
958599
public function getActiveClients()
    {
        $result = $this->getClients();
        if ( $result->isSuccess() ) {
            $clients = array();
            foreach ($result->data as $client) {
                if ($client->active == "true") {
                    $clients[$client->id] = $client;
                }
            }
            $result->data = $clients;
        }

        return $result;
    }
627125
private function _request()
    {
        $res = $this->_client->request(
            $this->_method,
            $this->_endpoint . '?' . $this->_query_parameters,
            [
                'headers' => $this->_headers,
                'http_errors' => false
            ]
        );
        return array(
            'code' => $res->getStatusCode(),
            'body' => new SimpleXMLElement($res->getBody())
        );
    }
342222
protected function getClientOptions()
    {
        $options = $this->clientOptions;
        
        if ($this->items !== null)
            $options['core']['data'] = $this->items;
        
        $options['core']['check_callback'] = isset($options['core']['check_callback']) ? $options['core']['check_callback'] : true;
                
        return $options;
    }
979320
protected function getRequesters() {
        $mapParentId = array();
        $mapAroId = array();

        $aros = $this->Aro->getAll();
        $permissions = $this->Permission->getAll();

        // Map ACOs to AROs indexed by IDs
        foreach ($permissions as $permission) {
            $permission = $permission['ObjectPermission'];

            $mapAroId[$permission['aro_id']][$permission['aco_id']] = $permission;
        }

        // Map IDs to parent IDs
        foreach ($aros as $aro) {
            $mapParentId[$aro['RequestObject']['id']] = $aro['RequestObject'];
        }

        // Loop through AROs and determine permissions
        // While taking into account inheritance
        foreach ($aros as &$aro) {
            $id = $aro['RequestObject']['id'];
            $parent_id = $aro['RequestObject']['parent_id'];
            $inheritance = array();

            while (isset($mapParentId[$parent_id])) {
                array_unshift($inheritance, $parent_id);
                $parent_id = $mapParentId[$parent_id]['parent_id'];
            }

            $inheritance[] = $id;

            // Fetch permissions from parents
            $perms = array();
            $parent_id = $aro['RequestObject']['parent_id']; // reset $parent_id

            foreach ($inheritance as $pid) {
                if (isset($mapAroId[$pid])) {
                    $perms = Hash::merge($perms, array_map(function($value) use ($id, $parent_id) {

                        // If the ARO on the permission doesn't match the current ARO
                        // It is being inherited, so force it to 0
                        if ($id != $value['aro_id']) {
                            $value = array_merge($value, array(
                                '_create' => 0,
                                '_read' => 0,
                                '_update' => 0,
                                '_delete' => 0
                            ));

                        // Top level AROs cant inherit from nothing
                        // So change those values to denied
                        } else if (empty($parent_id)) {
                            foreach (array('_create', '_read', '_update', '_delete') as $action) {
                                if ($value[$action] == 0) {
                                    $value[$action] = -1;
                                }
                            }
                        }

                        return $value;
                    }, $mapAroId[$pid]));
                }
            }

            $aro['ObjectPermission'] = $perms;
        }

        return $aros;
    }
889277
public function getAccessPolicyList()
    {
        $propertyList = $this->_getEntityList('AccessPolicies');
        $result = [];

        foreach ($propertyList as $properties) {
            $result[] = AccessPolicy::createFromOptions($properties);
        }

        return $result;
    }
920028
public function getAccessToken()
    {
        return $this->requestHandler->sendRequestAsync('POST', 'api/v4/oauth/access_token/')->then(
            function ($tokenValues) {
                parse_str($tokenValues, $tokenArray);
                $token = $tokenArray['oauth_token'];
                $tokenSecret = $tokenArray['oauth_token_secret'];
                $this->requestHandler->setAccessTokenCredentials($token, $tokenSecret);
                return $tokenArray;
            }
        );
    }
1338019
public function getMethods()
    {
        $requestMethod = $this->request->getAccessControlRequestMethod();
        if (in_array('*', $this->methods) && $requestMethod) {
            return $requestMethod;
        }

        return $this->methods;
    }
1278637
protected function getClient() {
        if ($this->client === null) {
            $this->client = new Client($this->getParam('accountId'), $this->getParam('applicationKey'));
        }

        return $this->client;
    }
228587
public function scopes()
	{
		if (isset($this->scopes)) {
			return $this->scopes;
		}
		
		return $this->scopes = DB::table('oauth_client_scopes')
			->select('scope_id')
			->where('client_id', $this->id)
			->lists('scope_id');
	}
124364
public function getAllowheaders()
    {
        $requestHeaders = $this->request->getAccessControlRequestHeaders();
        if (in_array('*', $this->allowedHeaders) && $requestHeaders) {
            return $requestHeaders;
        }

        return $this->allowedHeaders;
    }
998644
public function getClient(): ClientInterface
    {
        if ($this->client === null) {
            $this->client = new Client();
        }

        return $this->client;
    }
122392
protected function authClient(): ClientInterface
    {
        return new Client(new BasicAuth($this->clientId, $this->clientSecret), $this->auth_server);
    }
1194206
protected function requestAccessToken() {
        $code = $this->getRequestVar('code');
        if (!empty($code)) {
            $res = $this->sendRequest('POST', $this->getUrl('oauth', 'token'), array(
                'code' => $code,
                'client_id' => $this->getClientId(),
                'client_secret' => $this->getClientSecret(),
                'grant_type' => 'authorization_code',
                'redirect_uri' => $this->redirectUri,
            ));
            $result = $res->getBody();
            if ($result && $result = json_decode($result, true)) {
                if (!empty($result['error'])) {
                    throw new Exception($result['error_description']);
                }

                return $result;
            }
        }
        return null;
    }
302425
public function ldap()
    {
        if (is_null($this->ldapRequests)) {
            $this->ldapRequests = new System\LdapRequests($this->client);
        }

        return $this->ldapRequests;
    }