Assert Parameters and Give Request Parameters

@return array
@throws exMissingGrantRequestParams
331802
function assertTokenParams()
    {
        # Assert Params

        if ( null === $this->getClientId() || null === $this->getClientSecret() )
            throw new exMissingGrantRequestParams('Request Param "client_id" & "client_secret" must Set.');

        if ( null === $this->getToken() && null === $this->getRefreshToken() )
            throw new exMissingGrantRequestParams('Request Param "token" or "refresh_token" must Set.');


        # Build Request Params

        $params = $this->__toArray();
        return $params;
    }
922148
public function cleanReservedParams()
    {
        $params = array(
            "_format" => "format",
            "_limit" => "limit",
            "_offset" => "offset",
            "_sort" => "sort",
            "_direction" => "direction",
            "_debug" => "debug",
            "_options" => "options",
            "_locale" => "locale",
            "_mode" => "mode",
            "_template" => "template",
            "_flags" => "flags",
            "_ts" => "ts",
            "oauth_token" => "oauth_token",
            "callback" => "callback",
        );

        foreach ($params as $param => $paramKey) {
            if (isset($this->filterParameters[$param])) {
                \Ginger\System\Parameters::$$paramKey = $this->filterParameters[$param];
                unset($this->filterParameters[$param]);
            }
        }

        if (isset($this->dataParameters["oauth_token"])) {
            \Ginger\System\Parameters::$oauth_token = $this->dataParameters["oauth_token"];
            unset($this->dataParameters["oauth_token"]);
        }

        // Make auth header leading
        if (isset($_SERVER['HTTP_AUTHORIZATION'])) {
            $parts = explode(", ", $_SERVER['HTTP_AUTHORIZATION']);
            foreach ($parts as $part) {
                $check_for = "oauth_token";
                if (substr($part, 0, strlen($check_for)) == $check_for) {
                    \Ginger\System\Parameters::$oauth_token = trim(substr($part, strlen($check_for)));
                }
                $check_for2 = "Bearer";
                if (substr($part, 0, strlen($check_for2)) == $check_for2) {
                    \Ginger\System\Parameters::$bearer_token = trim(substr($part, strlen($check_for2)));
                }
            }

        }

        // Check for X-NI-API-Key
        if (isset($_SERVER['HTTP_X_API_KEY'])) {
            \Ginger\System\Parameters::$api_key = $_SERVER['HTTP_X_API_KEY'];
        }

        // Check for existing IP Address, but check if X-Original-IP isset
        if (isset($_SERVER['HTTP_X_ORIGINAL_IP'])) {
            \Ginger\System\Parameters::$ip = $_SERVER['HTTP_X_ORIGINAL_IP'];
        } else {
            \Ginger\System\Parameters::$ip = $_SERVER['REMOTE_ADDR'];
        }

        // Check for accept header and let it be leading
        if (isset($_SERVER['HTTP_ACCEPT']) && \Ginger\System\Parameters::$format === "json") {
            \Ginger\System\Parameters::$format = \Ginger\Format::getFormatByAcceptHeader($_SERVER['HTTP_ACCEPT']);
        }

        $lang = "";

        if (\Ginger\System\Parameters::$locale !== null) {
            $lang = \Ginger\System\Parameters::$locale;
        } else if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
            $lang = $_SERVER['HTTP_ACCEPT_LANGUAGE'];
        }

        \Ginger\Options::getInstance()->locale = new \Ginger\Locale($lang);
    }
248654
protected function defaultRequestParams()
    {
        $params = array(
            'authenticator' => $this->buildAuthenticator(),
            'ssl'           => $this->https === true ? 1 : 0,
            'ip'            => $this->serverAddress,
            'host'          => $this->httpHost,
        );
        return $params;
    }
519687
public function getParamsAsCode(): array
    {
        $paramsAsCode = [];

        foreach ($this->getParamNames() as $paramName) {
            $paramsAsCode[$paramName] = RequestPropertyUtility::getStringValueAsCode($this->$paramName);
        }

        return $paramsAsCode;
    }
1066497
public static function oauth_parameters() {
        // Find request headers
        $request_headers = OAuthUtil::get_headers();

        // Parse the query-string to find GET parameters
        if ( isset($_SERVER['QUERY_STRING']) ) {
            $parameters = OAuthUtil::parse_parameters($_SERVER['QUERY_STRING']);
        } else {
            $parameters = array();
        }

        // Add POST Parameters if they exist
        $parameters = array_merge($parameters, $_POST);

        // We have a Authorization-header with OAuth data. Parse the header
        // and add those overriding any duplicates from GET or POST
        if (isset($request_headers['Authorization']) &&
            substr($request_headers['Authorization'], 0, 6) == "OAuth ") {
            $header_parameters = OAuthUtil::split_header(
                $request_headers['Authorization']
            );
            $parameters = array_merge($parameters, $header_parameters);
        }
        return $parameters;
    }
626804
public function getParams(): array
    {
        $params = [
            'openid.assoc_handle' => $this->request->get(self::OPENID_ASSOC_HANDLE),
            'openid.signed' => $this->request->get(self::OPENID_SIGNED),
            'openid.sig' => $this->request->get(self::OPENID_SIG),
            'openid.ns' => self::OPENID_NS,
            'openid.mode' => 'check_authentication',
        ];

        $signedParams = explode(',', $this->request->get(self::OPENID_SIGNED));

        foreach ($signedParams as $item) {
            $value = $this->request->get('openid_'.str_replace('.', '_', $item));
            $params['openid.'.$item] = get_magic_quotes_gpc() ? stripslashes($value) : $value;
        }

        return $params;
    }
941808
public function queryParameters() {
		if(!$this->configured || $this->via != self::QUERY_PARAMETER)
			return array();
		
		return array($this->description->query_parameter => $this->token);
	}
769110
public function params($requestParams): array
    {
        // apply type and default value for request params
        $params = [];
        foreach ($this->params as $param => $type) {
            if (isset($requestParams[$param])) {
                switch ($type) {
                    case 'bool':
                    case 'boolean':
                        $params[] = (bool)$requestParams[$param];
                        break;
                    case 'int':
                    case 'integer':
                        $params[] = (int)$requestParams[$param];
                        break;
                    case 'float':
                        $params[] = (float)$requestParams[$param];
                        break;
                    case 'string':
                        $params[] = (string)$requestParams[$param];
                        break;
                    case 'array':
                        $params[] = (array)$requestParams[$param];
                        break;
                    default:
                        $params[] = $requestParams[$param];
                        break;
                }
            } elseif (isset($this->values[$param])) {
                $params[] = $this->values[$param];
            } else {
                $params[] = null;
            }
        }
        return $params;
    }
194078
public function get_return_params() {
        global $PAGE;

        $params = array();
        if (!WS_SERVER) {
            $params = $PAGE->url->params();
        }
        unset($params['id']);
        unset($params['action']);
        return $params;
    }
291059
public function getParameters()
    {
        $parameters = \array_merge($this->parameters, [
            'oauth_consumer_key'     => $this->consumerKey,
            'oauth_timestamp'        => $this->timestamp,
            'oauth_nonce'            => \sha1(\microtime()),
            'oauth_signature_method' => 'HMAC-' . self::HASH_ALGORITHM,
        ]);

        // The parameters above must be included in the signature generation.
        $parameters['oauth_signature'] = $this->generateOauthSignature($parameters);

        return $this->getSortedParameters($parameters);
    }
1268050
public function toRequestParams()
    {
        $requestParams = array();
        $requestParams["name"] = $this->_name;
        $requestParams["price"] = $this->_price;
        if ($this->_id != null)
        {
            $requestParams["id"] = $this->_id;
        }

        return $requestParams;
    }
263093
protected function params(Request $request, array $params, $default = null)
    {
        $data = [];
        foreach ($params as $param) {
            $data[$param] = $request->getParam($param, $default);
        }

        return $data;
    }
460119
protected function _getParams()
    {
        $aResult = array();
        $aParams = (array)$this->_getContainer()->getConfig()->getRequestParameter('aParams');

        foreach ($aParams as $sKey => $sValue) {
            $aResult[html_entity_decode($sKey)] = html_entity_decode($sValue);
        }

        return $aResult;
    }
618186
public function postRemap()
    {
        $oUri    = Factory::service('Uri');
        $iItemId = (int) $oUri->segment(4);
        if ($iItemId && $iItemId != activeUSer('id') && !userHasPermission('admin:auth:accounts:editothers')) {
            return [
                'status' => 401,
                'error'  => 'You do not have permission to update this resource',
            ];
        } elseif (!$iItemId && !userHasPermission('admin:auth:accounts:create')) {
            return [
                'status' => 401,
                'error'  => 'You do not have permission to create this type of resource',
            ];
        }

        return parent::postRemap();
    }
1153916
protected static function getAllParams() {
        if ($_SERVER['REQUEST_METHOD'] == 'PUT' || $_SERVER['REQUEST_METHOD'] == 'DELETE') {

            $input = file_get_contents('php://input');

            $encoded_data = array();

            if (isset($_SERVER['CONTENT_TYPE'])) {
                switch ($_SERVER['CONTENT_TYPE']) {
                    case 'application/x-www-form-urlencoded':
                        parse_str($input, $encoded_data);
                        break;
                    case 'application/json':
                        $encoded_data = json_decode($input);
                        break;
                    default :
                        $encoded_data = parse_raw_http_request($input);
                        break;
                }
            }

            if ($encoded_data) {
                foreach ($encoded_data as $key => $val) {
                    $_REQUEST[$key] = $val;
                }
            }
        }

        return $_REQUEST;
    }
1315123
protected function serializeAuthorizationParameters()
    {
        return sprintf(
            'id=%s&nonce=%s&realm=%s&version=%s',
            $this->id,
            $this->nonce,
            rawurlencode($this->realm),
            $this->version
        );
    }
356957
public function dumpParameters()
    {
        $parameters = [];

        foreach ($this->parameters as $parameterName => $parameterValue) {
            $parameters[$parameterName] = [
                'value'      => $parameterValue
            ];
        }

        return $parameters;
    }