Returns the redirect response.

@param string $type
Type of action, "login" or "register".

@return \Drupal\Core\Routing\TrustedRedirectResponse|\Symfony\Component\HttpFoundation\RedirectResponse
Returns a RedirectResponse.
962907
protected function getRedirectResponse($type) {
    $sdk = $this->getSdk($type);

    if ($sdk instanceof RedirectResponse) {
      return $sdk;
    }

    $this->authManager->setSdk($sdk);
    $url = $this->authManager->getAuthenticationUrl($type);

    return new TrustedRedirectResponse($url);
  }
922239
protected function getRedirect() : Redirect
    {
        $context = Context::getInstance();
        $redirect = new Redirect($context->getUrl($context->getParameter('controller_path')));
        return $redirect;
    }
350990
public function redirect($uri, int $status = 301): ResponseInterface
    {
        if (!\is_string($uri) && !$uri instanceof UriInterface) {
            throw new \InvalidArgumentException('Uri MUST be a string or Psr\Http\Message\UriInterface instance; received "' .
                (\is_object($uri) ? \get_class($uri) : \gettype($uri)) . '"');
        }

        $this->header->set('Location', (string) $uri);

        return $this->empty($status);
    }
1045853
public function handler(): Response
    {
        if ($this->redirect) {
            return response(null, 302, ['Location' => $this->redirect]);
        } elseif ($this->request->query->has('error')) {
            return view('error.twig', [
                'error' => $this->request->query->get('error'),
                'message' => $this->request->query->get('message')
            ]);
        } else {
            $this->addAssets();
            return view($this->template, $this->data);
        }
    }
276478
public function getResponder($type)
    {
        if (!is_string($type) || empty($type)) {
            throw new \InvalidArgumentException('The responder type is invalid');
        }

        return $this->responders[$type] ?: null;
    }
5164
public function deleteAction(Redirection $redirection)
    {
        $em = $this->getDoctrine()->getManager();

        $em->remove($redirection);
        $em->flush();

        /** @var RedirectionRepository $redirectionRepository */
        $redirectionRepository = $em->getRepository('VictoireSeoBundle:Redirection');

        $this->congrat($this->get('translator')->trans('victoire.redirection.delete.success'));

        if (0 == count($redirectionRepository->getUnresolvedQuery()->getQuery()->getResult())) {
            return new Response($this->renderView('@VictoireSeo/Error404/_empty.html.twig'), 200, [
                'X-Inject-Alertify' => true,
            ]);
        }

        return new Response(null, 200, [
            'X-Inject-Alertify' => true,
            'X-VIC-Remove'      => '100ms',
        ]);
    }
1047657
public function redirect()
    {
        $this->request->getSession()->set(
            'oauth.temp', $temp = $this->server->getTemporaryCredentials()
        );

        return new RedirectResponse($this->server->getAuthorizationUrl($temp));
    }
218220
public function redirect($redirectUrl = null)
    {
        $state = null;

        if (!is_null($redirectUrl)) {
            $this->redirectUrl = $redirectUrl;
        }

        if ($this->usesState()) {
            $state = $this->makeState();
        }

        return new RedirectResponse($this->getAuthUrl($state));
    }
538281
public function returnType($type = null)
  {
    if (null === $type)
    {
      return $this->responseConfig['returnType'];
    }

    $this->responseConfig['returnType'] = $type;

    return $this;
  }
880387
public static function input(string $type)
    {
        $self = self::$input[$type] ?? new self;

        self::$input[$type] = $self;

        switch (strtoupper($type)) {
            case 'GET':
            case 'POST':
                $self->params = filter_input_array(constant('INPUT_' . $type)) ?? [];
                break;
            case 'PUT':
            case 'DELETE':
                $self->params = self::getParsedInput();
                break;
        }

        return function ($key = null) use ($self) {
            $self->key = $key;

            return $self;
        };
    }
745118
public function redirect($url)
    {
        return new RedirectResponse(
            sprintf(self::PRE_AUTH_LINK, $this->getSuiteId(), $this->getCode(), urlencode($url))
        );
    }
690979
public function getAuthorizationUrl($redirect_uri, $response_type = 'code')
    {
        return sprintf('https://%s/auth/o/login/?%s',
            str_replace('api.', '', parse_url($this->adapter->getEndpoint(), PHP_URL_HOST)),
            http_build_query([
                'response_type' => $response_type,
                'client_id' => $this->adapter->getClient(),
                'redirect_uri' => $redirect_uri,
            ])
        );
    }
276636
public function redirect()
    {
        $state = null;

        if ($this->usesState()) {
            $this->request->getSession()->set('state', $state = Str::random(40));
        }

        return new RedirectResponse($this->getAuthUrl($state));
    }
1003669
public function forceSsl($type) {
		$host = env('SERVER_NAME');
		if (empty($host)) {
			$host = env('HTTP_HOST');
		}
		if ('secure' == $type) {
			$this->redirect('https://' . $host . $this->here);
		}
	}
1128450
public function getHttpRedirectBindingResponse(AuthnRequest $request = null)
    {
        if (is_null($request)) {
            $request = $this->buildAuthnRequest();
        }

        $context = new MessageContext();
        $context->setMessage($request);

        $binding = (new BindingFactory())->create(SamlConstants::BINDING_SAML2_HTTP_REDIRECT);

        return new RedirectResponse($binding->send($context)->getTargetUrl());
    }
934433
function redirect($url, $type = 303) {
		if ($type === 303) {
			$this->http_response_code(303);
		}
		else if ($type == 301) {
			$this->http_response_code(301);
		}
		else if ($type == 307) {
			$this->http_response_code(307);
		}

		// redirect to...
		$this->header("Location: $url");
	}
502225
public function getAuthenticationUrl($type = 'private')
    {
        if (!$this->getRedirect()) {
            throw new \Exception('please set a redirect url for your permissions request');
        }

        $config = $this->getConfig();
        if (!isset($config['dataset'][$type])) {
            // @todo Is this configurable?
            throw new \Exception('unknown action. please check your apiconfig.yml file for the available types');
        }

        $params = array();
        $params['response_type'] = 'code';
        $params['client_id'] = $config['api_key'];
        $params['redirect_uri'] = $this->getRedirect();
        $params['scope'] = $config['dataset'][$type]['scope'];
        $params['state'] = $this->resetState()->getState();

        $url = $config['urls']['auth'] . '?' . http_build_query($params);

        return $url;
    }