Handle a submission for a given provider - build redirection

@param string $name
@return HTTPResponse
548522
public function handleProvider($name)
    {
        $this->extend('onBeforeHandleProvider', $name);

        $providers = Config::inst()->get($this->authenticator_class, 'providers');
        $config = $providers[$name];
        $scope = isset($config['scopes']) ? $config['scopes'] : ['email']; // We need at least an email address!
        $url = Helper::buildAuthorisationUrl($name, 'login', $scope);

        return $this->getController()->redirect($url);
    }
170600
public function create($name)
    {
        $config = $this->getConfiguration($name);

        if(null === $config) {
            throw new \RuntimeException(
                "Connection with name: $name not found."
            );
        }

        return new Client($config);
    }
640462
public function addButtonSubmit(string $name) : Element\Button\Submit
    {
        $button = new Element\Button\Submit($this, $name);
        $this->addComponent($name, $button);

        return $button;
    }
229805
private function setHeader($name, $value = null, $httpResponseCode = null)
    {
        header($name . ($value ? ': ' . $value : ''), true, $httpResponseCode);
    }
203943
protected static function getRedirectUri($name)
	{
		// Get the hub url
		$service = trim(Request::base(), '/');

		if (substr($service, -13) == 'administrator')
		{
			$scope = '/index.php?option=com_login&task=login&authenticator=' . $name;
		}
		else
		{
			// If someone is logged in already, then we're linking an account
			$task  = (User::isGuest()) ? 'user.login' : 'user.link';
			$scope = '/index.php?option=com_users&task=' . $task . '&authenticator=' . $name;
		}

		return $service . $scope;
	}
479998
protected function resolveAction($name)
    {
        if (isset($this->actions[$name])) {
            return $this->factory->make($this->actions[$name]);
        }

        throw new \InvalidArgumentException("Named action '$name' could not be found.");
    }
265250
public function addInputUrl(string $name) : Element\Input\Url
    {
        $input = new Element\Input\Url($this, $name);
        $this->addComponent($name, $input);

        return $input;
    }
1171275
public function redirectAction(Request $request, $name, $code = 301)
    {
        return new RedirectResponse(
            $this->get('zicht_url.provider')->url($name),
            $code
        );
    }
1047657
public function redirect()
    {
        $this->request->getSession()->set(
            'oauth.temp', $temp = $this->server->getTemporaryCredentials()
        );

        return new RedirectResponse($this->server->getAuthorizationUrl($temp));
    }
1234129
public static function header($name = null, $value = null) {
        if (!$name && !$value) {
            return Router::getInstance()->response->headers;

        } else if ($name && $value) {
            return Router::getInstance()->response->headers->set($name, $value);

        } else if ($name && !$value) {
            return Router::getInstance()->response->headers->get($name);
        }
    }
335211
public function assertRedirectedToAction($name, $parameters = [], $with = [])
    {
        return $this->assertRedirectedTo($this->app['url']->action($name, $parameters), $with);
    }
216714
public function move($dir, $name = null)
    {
        if ($this->isValid()) {

            if ($this->test) {
                return parent::move($dir, $name);
            }

            if (is_uploaded_file($this->getPathname())) {

                $target = $this->getTargetFile($dir, $name);

                move_uploaded_file($this->getPathname(), $target);

                chmod($target, 0666 & ~umask());

                return $target;
            }
        }

        throw new \RuntimeException("The file {$this->getPathname()} has not been uploaded via Http");
    }
289762
public function listen($name)
    {
        if(!isset($this->providersDeferred[$name]))
            return;

        $this->register(new $this->providersDeferred[$name]);

        unset($this->providersDeferred[$name]);
    }
859847
protected function createCacheDriver(string $name): ProviderContract
    {
        $config = $this->config['cache'][$name] ?? [];
        $cache = $this->getCacheRepository($config);

        return $this->createProvider(new Cache($name, $config, $cache));
    }
834321
public function post(
        string $definition,
        RequestHandlerInterface $handler,
        ?string $name = null,
        $data = null
    ): Route {
        return $this->route(Method::POST, $definition, $handler, $name, $data);
    }
560033
public function _($name = null)
    {
        if (isset($name)) {
            $this->path[] = $name;
        }
        $client = new static($this->host, $this->headers);
        $client->setPath($this->path);
        $client->setCurlOptions($this->curlOptions);
        $client->setRetryOnLimit($this->retryOnLimit);
        $this->path = [];

        return $client;
    }
1020295
public function signInWithProvider($provider_name, Request $request)
    {
        $provider = $this->getProvider($provider_name, $request);

        if (!$provider) {
            return $this->response(['errors' => [
                'code'    => 'PROVIDER_NOT_FOUND',
                'message' => 'No provider found',
            ]], Response::HTTP_BAD_REQUEST);
        }

        $provider->stateless();

        if ($request->input('code') !== null) {
            try {
                return $this->authenticateByCode($provider, $request->input('code'));
            } catch (\Exception $e) {
                return $this->response([
                    'code'    => 'CODE_NOT_VALID',
                    'message' => 'Code invalid or expired'.$e->getMessage(),
                ], Response::HTTP_BAD_REQUEST);
            }
        }
    }