Validate a request signature.
@param  string             $path   The resource path.
@param  array              $params The manipulation params.
@throws SignatureException
323519
public function validateRequest($path, array $params)
    {
        if (!isset($params['s'])) {
            throw new SignatureException('Signature is missing.');
        }

        if ($params['s'] !== $this->generateSignature($path, $params)) {
            throw new SignatureException('Signature is not valid.');
        }
    }
1291085
protected function post($path, array $parameters = array(), $body = array())
    {
        if (count($parameters) > 0) {
            $path .= '?' . http_build_query($parameters);
        }

        $body = json_encode($body);

        $response = $this->client->getHttpClient()->post($path, [], $body);

        return $this->parseResponse($response);
    }
1355778
protected function httpDelete(string $path, array $params = [], array $requestHeaders = []): ResponseInterface
    {
        return $this->httpClient->sendRequest(
            $this->requestBuilder->create('DELETE', $path, $requestHeaders, $this->createJsonBody($params))
        );
    }
700453
public function call($path, $params = array(), $method = self::METHOD) {
    $url = $this->baseURI . $path;
    if ($this->key_type == 'opensearch') {
      $params['client_id'] = $this->clientId;
      $params['nonce'] = $this->_nonce();
      $params['sign'] = $this->_sign($params);
    } else {
      $params['Version'] = $this->version;
      $params['AccessKeyId'] = $this->accessKeyId;
      $params['SignatureMethod']=$this->signatureMethod;
      $params['SignatureVersion']=$this->signatureVersion;
      $params['SignatureNonce'] = $this->_nonce_aliyun();
      $params['Timestamp'] = gmdate('Y-m-d\TH:i:s\Z');
      $params['Signature'] = $this->_sign_aliyun($params,$method);
    }
    if ($this->connect == 'curl') {
      $result = $this->_curl($url, $params, $method);
    } else {
      $result = $this->_socket($url, $params, $method);
    }
    return $result;
  }
915789
private function _verifySignature(ValidatorState $state, Certificate $cert)
    {
        try {
            $valid = $cert->verify($state->workingPublicKey(), $this->_crypto);
        } catch (\RuntimeException $e) {
            throw new PathValidationException(
                "Failed to verify signature: " . $e->getMessage(), 0, $e);
        }
        if (!$valid) {
            throw new PathValidationException(
                "Certificate signature doesn't match.");
        }
    }
759447
protected function validatePath(string $path): void
    {
        if (empty($path)) {
            $this->fail(new InvalidArgumentException("Path is not specified"));
        }

        if (!is_string($path)) {
            $this->fail(new InvalidArgumentException("Path is not a string"));
        }
    }
804731
protected static function validatePath($path)
    {
        // Validate path by default logic
        $path = parent::validatePath($path);

        // Collection of existing folders for error message
        $existingFolders = array();

        // Check now if any of the target directories exists
        foreach (self::getFolders() as $folder) {
            if (file_exists($path . $folder)) {
                $existingFolders[] =  $folder . '/';
            }
        }

        // Any folder found? => Exception
        if (count($existingFolders) > 0) {
            throw new Exception(
                'The target directory contains the following files/folders already: ' .
                implode(' & ', $existingFolders) . '.' . PHP_EOL . 'Remove those files/folders first and try again.' .
                PHP_EOL
            );
        }

        return $path;
    }
823612
private function validateParameters(array $params) {
        if (empty($params['width']) || empty($params['height'])) {
            throw new TransformationException('Both width and height needs to be specified', 400);
        }

        // Get POI from transformation params
        $poi = empty($params['poi']) ? null : explode(',', $params['poi']);

        // Check if we have the POI in metadata
        if (!$poi) {
            $metadataPoi = $this->getPoiFromMetadata();

            if ($metadataPoi) {
                $poi = $metadataPoi;
            }
        }

        if ($poi) {
            if (!isset($poi[0]) || !isset($poi[1])) {
                throw new TransformationException('Invalid POI format, expected format `<x>,<y>`', 400);
            }

            if (!empty($params['crop']) && in_array($params['crop'], ['close', 'medium', 'wide']) === false) {
                throw new TransformationException('Invalid crop value. Valid values are: close,medium,wide', 400);
            }
        }

        $params['closeness'] = (isset($params['crop']) ? $params['crop'] : 'medium');
        $params['poi'] = $poi;

        return $params;
    }
628697
public function verifyCallbackRequest(array $params)
    {
        return $this->signatureCallback
            ->setOrderId(array_get($params, 'Order_ID'))
            ->setStatus(array_get($params, 'Status'))
            ->setFields(array_except($params, ['Order_ID', 'Status', 'Signature']))
            ->setPassword($this->getPassword())
            ->verify(array_get($params, 'Signature'));
    }
950243
public function post($path, $params, $multipart = false)
    {
        return $this->ttools->makeRequest(
            TTools::API_BASE . '/' . TTools::API_VERSION . $path,
            $params,
            'POST',
            $multipart
        );
    }
410359
protected function doPost($path, array $params = null, array $data = null)
    {
        return $this->getResult('POST', $path, $params, $data);
    }
1178958
public function post($path, $params)
    {
        $idempotencyKey = uniqid("", true);
        $paramsWithHeaders = array("headers" => array("Idempotency-Key" => $idempotencyKey));
        $params = array_replace_recursive($paramsWithHeaders, $params);

        $response = $this->http_client->request('POST', $path, $params);

        $this->handleErrors($response);
        return $response;
    }
370540
public function get($path, $params = array())
    {
        if (is_array($params) && array_key_exists("query", $params)) {
            $params["query"] = $this->castBooleanValuesToStrings($params["query"]);
        }

        $response = $this->http_client->request('GET', $path, $params);
        $this->handleErrors($response);
        return $response;
    }
1339260
public function validate(...$params)
    {
        /**
         * @var Request $request
         * @var array   $matches
         */
        list($validators, $request, $matches) = $params;

        if (! \is_array($validators)) {
            return $request;
        }

        foreach ($validators as $type => $validatorAry) {
            $request = $this->validateField($request, $matches, $type, $validatorAry);
        }

        return $request;
    }
10161
protected function put(string $path, array $params = [], array $headers = [])
    {
        $body = self::createJsonBody($params);

        if ($body) {
            $headers = self::addJsonContentType($headers);
        }

        return $this->putRaw($path, $body, $headers);
    }
93570
def post(path, params={})
      signature_params = params.values.any?{|value| value.respond_to?(:to_io)} ? {} : params
      request(:post, path, params, signature_params)
    end
872107
public function matches($path)
    {
        if (preg_match($this->expr, $path, $this->matches) &&
            in_array($_SERVER['REQUEST_METHOD'], $this->methods)) {
            return true;
        }

        return false;
    }