Resolve request signature.

@param \Illuminate\Http\Request $request

@return string
190110
protected function resolveRequestSignature($request)
    {
        $route = $request->route()[1];

        if (! $route) {
            throw new RuntimeException('Unable to generate fingerprint. Route unavailable.');
        }

        return \sha1(
            \implode('|', $route['version']).'|'.$request->fullUrl().'|'.$request->ip()
        );
    }
759020
protected function resolveValidator(Request $request)
    {
        if (! isset($this->validators[$request->getHandler()])) {
            return null;
        }

        try {
            $validatorClass = $this->validators[$request->getHandler()];
            return $this->container->make($validatorClass);
        } catch (BindingResolutionException $e) {
            return null;
        }
    }
145955
public function signIn(Request $request)
    {
        $oauth_client = DB::table('oauth_clients')->where('password_client', 1)->first();

        if (!$oauth_client) {
            return $this->response([
                'code' => 'CLIENT_NOT_FOUND',
            ], Response::HTTP_BAD_REQUEST);
        }

        $request->request->add([
            'username'      => $request->input('username'),
            'password'      => $request->input('password'),
            'scope'         => '*',
            'grant_type'    => 'password',
            'client_id'     => $oauth_client->id,
            'client_secret' => $oauth_client->secret,
        ]);
        $request = Request::create('/oauth/token', 'POST', []);

        $response = Route::dispatch($request);

        $body = json_decode($response->getContent());

        if ($response->getStatusCode() === 200) {
            return $this->response(['data' => $body], Response::HTTP_OK);
        }

        if ($response->getStatusCode() === 401) {
            return $this->response(['errors' => ['code' => 'NOT_VALID', 'message' => $body->error]], Response::HTTP_UNAUTHORIZED);
        }

        if ($response->getStatusCode() === 400) {
            return $this->response(['errors' => ['code' => 'BAD_REQUEST', 'message' => $body->message]], Response::HTTP_BAD_REQUEST);
        }
    }
196915
public function negotiate(Request $request)
    {
        if ([] === $this->supportedLocales) {
            return null;
        }

        if (!$request->hasHeader('Accept-Language')) {
            return null;
        }

        $aggregatedValues = $this->aggregatedValues($request->getHeaderLine('Accept-Language'));

        return $this->compareAgainstSupportedLocales($aggregatedValues);
    }
523474
protected function getSignatureFromRequest(Request $request): string
    {
        if (!$request->hasHeader(self::HEADER_AUTHENTICATE_SIGNATURE)) {
            throw new UnauthorizedException('Signature is required.');
        }

        $signature = current($request->getHeader(self::HEADER_AUTHENTICATE_SIGNATURE));

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

        return $format;
    }
529961
public function apply(Request $request)
    {
        if (IpUtils::checkIp($request->getClientIp(), $this->subnet)) {
            $name = $this->extractFieldInfo($request->headers, $this->headerField);
            if (!empty($name)) {
                return $name;
            }
        }

        return '';
    }
1083855
public function sign(RequestInterface $request)
    {
        $oAuthParams = array_merge(
            $this->getDefaultOAuthParams(),
            ['oauth_signature_method' => $this->signatureMethod->getName()]
        );

        $oAuthParams['oauth_signature'] = $this->signatureMethod->buildSignature(
            $request,
            $oAuthParams,
            $this->consumer,
            $this->token
        );

        return $request->withHeader(
            'authorization',
            $this->buildAuthorizationHeader($oAuthParams)
        );
    }
1061223
protected function signRequest($request)
    {
        $url = $request->getUrl(true);
        $url->getQuery()->add('key', $this->key);

        $request->setUrl($url);
    }
1341171
public function resolve(Request $request) : Response {
        if($request->expectsJson()) {
            return $this->json();
        }

        return $this->redirect();
    }
601902
public function getPathAction(Request $request)
    {
        /* @var $response JsonResponse */
        $response = $this->getCacheTimeKeeper()
            ->getResponse('AnimeDbCatalogBundle:Storage', -1, new JsonResponse());
        // response was not modified for this request
        if ($response->isNotModified($request)) {
            return $response;
        }

        /* @var $storage Storage */
        $storage = $this->getDoctrine()->getManager()
            ->find('AnimeDbCatalogBundle:Storage', $request->get('id'));

        return $response->setData([
            'required' => $storage->isPathRequired(),
            'path' => $storage->getPath(),
        ]);
    }
280165
public function get(Request $request)
    {
        $this->collect($request);

        return implode(PHP_EOL, $this->parts);
    }
834019
public function index(string $request) : string
    {
        $jsonRpcCall = null;
        try {
            $jsonRpcCall = $this->getJsonRpcCall($request);

            $jsonRpcCallResponse = $this->getJsonRpcCallResponse($jsonRpcCall);

            return $this->getResponseString($jsonRpcCallResponse, $jsonRpcCall);
        } catch (\Exception $exception) {
            // Try to create a valid json-rpc error
            $jsonRpcCallResponse = (new JsonRpcCallResponse())->addResponse(
                $this->exceptionHandler->getJsonRpcResponseFromException($exception)
            );

            return $this->getResponseString($jsonRpcCallResponse, $jsonRpcCall);
        }
    }
1360180
private function createSignature(RequestInterface $request)
    {
        $headers = $request->getHeaders();
        ksort($headers);

        $signatureData = $request->getMethod() . ' ' . $request->getRequestTarget();
        $signatureData .= $this->createSignatureDataFromHeaders($headers);
        $signatureData .= "\n\n";

        $body = (string)$request->getBody();
        if (!empty($body)) {
            $signatureData .= $body;
        }

        return $this->sign($signatureData);
    }
366191
public function verifyRedirect($request)
    {
        if(empty($request)) {//判断请求的参数是否为空
            return false;
        }

        //生成签名结果
        $data['prestr'] = Helper::buildRequestPreStr($request);
        $data['sign'] = $request['sign'];
        $isSign = $this->sign->verifySign($data, trim($this->config[$this->signKeyConfigName]));

        return $isSign;
    }
697086
protected function getThrottleKey(Request $request)
    {
        return mb_strtolower($request->input($this->loginUsername())) .'|' .$request->ip();
    }
998793
public function autocompleteNameAction(Request $request)
    {
        /* @var $response JsonResponse */
        $response = $this->getCacheTimeKeeper()
            ->getResponse('AnimeDbCatalogBundle:Item', -1, new JsonResponse());
        // response was not modified for this request
        if ($response->isNotModified($request)) {
            return $response;
        }

        $term = mb_strtolower($request->get('term'), 'UTF8');
        /* @var $service Manager */
        $service = $this->get('anime_db.item.search');
        $result = $service->searchByName($term, self::AUTOCOMPLETE_LIMIT);

        $list = [];
        /* @var $item Item */
        foreach ($result as $item) {
            if (strpos(mb_strtolower($item->getName(), 'UTF8'), $term) === 0) {
                $list[] = $item->getName();
            } else {
                /* @var $name Name */
                foreach ($item->getNames() as $name) {
                    if (strpos(mb_strtolower($name->getName(), 'UTF8'), $term) === 0) {
                        $list[] = $name->getName();
                        break;
                    }
                }
            }
        }

        return $response->setData($list);
    }