You are here

private function RedirectMiddleware::redirectUri in Auth0 Single Sign On 8.2

Set the appropriate URL on the request based on the location header

Parameters

RequestInterface $request:

ResponseInterface $response:

array $protocols:

Return value

UriInterface

1 call to RedirectMiddleware::redirectUri()
RedirectMiddleware::modifyRequest in vendor/guzzlehttp/guzzle/src/RedirectMiddleware.php

File

vendor/guzzlehttp/guzzle/src/RedirectMiddleware.php, line 230

Class

RedirectMiddleware
Request redirect middleware.

Namespace

GuzzleHttp

Code

private function redirectUri(RequestInterface $request, ResponseInterface $response, array $protocols) {
  $location = Psr7\UriResolver::resolve($request
    ->getUri(), new Psr7\Uri($response
    ->getHeaderLine('Location')));

  // Ensure that the redirect URI is allowed based on the protocols.
  if (!in_array($location
    ->getScheme(), $protocols)) {
    throw new BadResponseException(sprintf('Redirect URI, %s, does not use one of the allowed redirect protocols: %s', $location, implode(', ', $protocols)), $request, $response);
  }
  return $location;
}