Resolve request signature.

@param Request $request

@return string
774359
protected function resolveRequestSignature($request)
    {
        return sha1(
            $request->method() .
            '|' . $request->server('SERVER_NAME') .
            '|' . $request->path() .
            '|' . $request->ip()
        );
    }
690540
private function getPostRequestEncoding( Request $request ) {
		if ( $request instanceof MultipartRequest ) {
			return 'multipart';
		}
		foreach ( $request->getParams() as $value ) {
			if ( is_resource( $value ) ) {
				return 'multipart';
			}
		}
		return 'form_params';
	}
1061223
protected function signRequest($request)
    {
        $url = $request->getUrl(true);
        $url->getQuery()->add('key', $this->key);

        $request->setUrl($url);
    }
269465
public function signRequest(RequestInterface $request)
    {
        $signatureString = sprintf(
            "(request-target): %s %s\ndate: %s",
            mb_strtolower($request->getMethod()),
            $request->getRequestTarget(),
            $request->getHeaderLine('date')
        );

        $signature = base64_encode(hash_hmac('sha256', $signatureString, $this->api_secret, true));

        $header = sprintf(
            'Signature keyId="%s",algorithm="hmac-sha256",headers="(request-target) date",signature="%s"',
            $this->api_key,
            $signature
        );

        return $request->withHeader('Authorization', $header);
    }
878373
private function getLocale(Request $request)
    {
        $uri = $request->getRequestUri();

        foreach ($this->locales as $locale) {
            if (false !== strpos($uri, '/'.$locale.'/')) {
                return $locale;
            }
        }

        return $this->defaultLocale;
    }
1367872
protected function resolveAuthorizer(Request $request)
    {
        if (! isset($this->authorizers[$request->getHandler()])) {
            return null;
        }

        try {
            $authorizerClass = $this->authorizers[$request->getHandler()];
            return $this->container->make($authorizerClass);
        } catch (BindingResolutionException $e) {
            return null;
        }
    }
588518
public function getRequest( Request $request ) {
		$response = $this->getClient()->request(
			'GET',
			$this->apiUrl,
			$this->getClientRequestOptions( $request, 'query' )
		);

		return $this->decodeResponse( $response );
	}
1060562
protected function getErrorForRequest(Request $request)
    {
        $authenticationErrorKey = Security::AUTHENTICATION_ERROR;

        if ($request->attributes->has($authenticationErrorKey)) {
            return $request->attributes->get($authenticationErrorKey);
        }

        $session = $request->getSession();
        if (null !== $session && $session->has($authenticationErrorKey)) {
            $error = $session->get($authenticationErrorKey);
            $session->remove($authenticationErrorKey);

            return $error;
        }

        return '';
    }
1308504
public function getTransactionName(Request $request)
    {
        $route = $request->route();

        if (is_array($route)) {
            // Try the assigned controller action
            if (isset($route[1]) && isset($route[1]['uses'])) {
                return $route[1]['uses'];
            } // Try named routes
            elseif (isset($route[1]) && isset($route[1]['as'])) {
                return $route[1]['as'];
            }
        }

        return 'index.php';
    }
787732
protected function getFormat(Request $request)
    {
        $format = $request->getQueryParam('format');
        if (!isset($format)) {
            $format = $this->defaultFormat;
        }

        return $format;
    }
416704
public function resolve(Request $request)
    {
        //locale
        switch ($this->localePattern) {
            case self::PATTERN_DOMAIN:
                $locale = $this->resolveFromDomain($request);
                $request->setLocale($locale);
                break;
        }

        return $request->getLocale();
    }
44317
protected function getSignatureMethod(&$request)
    {
        $signature_method =
            @$request->getParameter("oauth_signature_method");
        
        if (!$signature_method) {
            // According to chapter 7 ("Accessing Protected Ressources") the signature-method
            // parameter is required, and we can't just fallback to PLAINTEXT
            throw new OAuthException('No signature method parameter. This parameter is required');
        }
        
        if (!in_array($signature_method,
            array_keys($this->signature_methods))
        ) {
            throw new OAuthException(
                "Signature method '$signature_method' not supported " .
                "try one of the following: " .
                implode(", ", array_keys($this->signature_methods))
            );
        }
        
        return $this->signature_methods[ $signature_method ];
    }
1248822
public function negotiate(Request $request)
    {
        $this->request = $request;

        if ( ! is_null($locale = $this->getFromAcceptedLanguagesHeader()))
            return $locale;

        if ( ! is_null($locale = $this->getFromHttpAcceptedLanguagesServer()))
            return $locale;

        if ( ! is_null($locale = $this->getFromRemoteHostServer()))
            return $locale;

        // TODO: Adding negotiate form IP Address ??

        return $this->defaultLocale;
    }
566852
public function signWithServer($request)
    {
        //server
        $clientRequest = json_decode($request);
        $this->crt->setSignedCert(openssl_csr_sign($clientRequest->csr, $this->_getCaCert(), $this->_getCaKey(), $this->_getConfig('daysvalid'), $this->certConfigure, time()));

        // return signed file to user
        openssl_x509_export($this->crt->getSignedCert(), $clientCertificate);

        return json_encode(['certificate' => $clientCertificate]);
    }
1307508
private function getCacheKey(RequestInterface $request)
    {
        return implode('|', [$request->getIndex(), $request->getType(), $request->getQueryText()]);
    }
498371
private function getTraceKey(Request $request): string
    {
        $path = $request->getPathInfo();
        if ($qs = $request->getQueryString()) {
            $path .= '?'.$qs;
        }

        return $request->getMethod().' '.$path;
    }
129417
public function parse(Request $request)
    {
        $header = $request->headers->get($this->header) ?: $this->fromAltHeaders($request);

        if ($header && preg_match('/'.$this->prefix.'\s*(\S+)\b/i', $header, $matches)) {
            return $matches[1];
        }
    }