Handles the request from the provider

@return Redirect
171823
public function auth()
        {

            if ($user = $this->socializer->login()):

                $login = User::firstOrCreate(["email" => $user['email']], $user);
                Auth::login($login);
                return redirect($this->redirectTo)->with("success", "You are logged in");

            endif;

            return redirect($this->redirectTo)->with("error", "Failed to login please try again");

        }
246221
public function handleRequest() {
		$files = array();
		$supportsGzip = false;
		$expiresOffset = $this->parseTime($this->settings["expires"]);
		$tinymceDir = dirname(__FILE__);

		// Plugins
		$plugins = self::getParam("plugins");
		if ($plugins) {
			$this->settings["plugins"] = $plugins;
		}

		$plugins = array_unique(preg_split('/,/', $this->settings["plugins"], -1, PREG_SPLIT_NO_EMPTY));

		// Themes
		$themes = self::getParam("themes");
		if ($themes) {
			$this->settings["themes"] = $themes;
		}

		$themes = array_unique(preg_split('/,/', $this->settings["themes"], -1, PREG_SPLIT_NO_EMPTY));

		// Languages
		$languages = self::getParam("languages");
		if ($languages) {
			$this->settings["languages"] = $languages;
		}

		$languages = array_unique(preg_split('/,/', $this->settings["languages"], -1, PREG_SPLIT_NO_EMPTY));

		// Files
		$tagFiles = self::getParam("files");
		if ($tagFiles) {
			$this->settings["files"] = $tagFiles;
		}

		// Diskcache option
		$diskCache = self::getParam("diskcache");
		if ($diskCache) {
			$this->settings["disk_cache"] = ($diskCache === "true");
		}

		// Source or minified version
		$src = self::getParam("src");
		if ($src) {
			$this->settings["source"] = ($src === "true");
		}

		// Add core js
		if (self::getParam("core", "true") === "true") {
			$files[] = "tinymce";
		}

		// Add core languages
		foreach ($languages as $language) {
			$files[] = "langs/" . $language;
		}

		// Add plugins
		foreach ($plugins as $plugin) {
			$files[] = "plugins/" . $plugin . "/plugin";

			foreach ($languages as $language) {
				$files[] = "plugins/" . $plugin . "/langs/" . $language;
			}
		}

		// Add themes
		foreach ($themes as $theme) {
			$files[] = "themes/" . $theme . "/theme";

			foreach ($languages as $language) {
				$files[] = "themes/" . $theme . "/langs/" . $language;
			}
		}

		// Add any specified files.
		$allFiles = array_merge($files, array_unique(preg_split('/,/', $this->settings['files'], -1, PREG_SPLIT_NO_EMPTY)));

		// Process source files
		for ($i = 0; $i < count($allFiles); $i++) {
			$file = $allFiles[$i];

			if ($this->settings["source"] && file_exists($file . ".js")) {
				$file .= ".js";
			} else if (file_exists($file . ".min.js"))  {
				$file .= ".min.js";
			} else {
				$file = "";
			}

			$allFiles[$i] = $file;
		}

		// Generate hash for all files
		// CUSTOM SilverStripe Webroot-specific caches
		$hash = md5(implode('', $allFiles) . $_SERVER['SCRIPT_NAME']);
		// CUSTOM END

		// Check if it supports gzip
		$zlibOn = ini_get('zlib.output_compression') || (ini_set('zlib.output_compression', 0) === false);
		$encodings = (isset($_SERVER['HTTP_ACCEPT_ENCODING'])) ? strtolower($_SERVER['HTTP_ACCEPT_ENCODING']) : "";
		$encoding = preg_match( '/\b(x-gzip|gzip)\b/', $encodings, $match) ? $match[1] : "";

		// Is northon antivirus header
		if (isset($_SERVER['---------------'])) {
			$encoding = "x-gzip";
		}

		$supportsGzip = $this->settings['compress'] && !empty($encoding) && !$zlibOn && function_exists('gzencode');

		// Set cache file name
		$cacheFile = $this->settings["cache_dir"] . "/tinymce.gzip-" . $hash . ($supportsGzip ? ".gz" : ".js");

 		// Set headers
		header("Content-type: text/javascript");
		header("Vary: Accept-Encoding");  // Handle proxies
		header("Expires: " . gmdate("D, d M Y H:i:s", time() + $expiresOffset) . " GMT");
		header("Cache-Control: public, max-age=" . $expiresOffset);

		if ($supportsGzip) {
			header("Content-Encoding: " . $encoding);
		}

		// Use cached file
		if ($this->settings['disk_cache'] && file_exists($cacheFile)) {
			readfile($cacheFile);
			return;
		}

		// Set base URL for where tinymce is loaded from
		$buffer = "var tinyMCEPreInit={base:'" . dirname($_SERVER["SCRIPT_NAME"]) . "',suffix:'.min'};";

		// Load all tinymce script files into buffer
		foreach ($allFiles as $file) {
			if ($file) {
				$fileContents = $this->getFileContents($tinymceDir . "/" . $file);
//				$buffer .= "\n//-FILE-$tinymceDir/$file (". strlen($fileContents) . " bytes)\n";
				$buffer .= $fileContents;
			}
		}

		// Mark all themes, plugins and languages as done
		$buffer .= 'tinymce.each("' . implode(',', $files) . '".split(","),function(f){tinymce.ScriptLoader.markDone(tinyMCE.baseURL+"/"+f+".js");});';

		// Compress data
		if ($supportsGzip) {
			$buffer = gzencode($buffer, 9, FORCE_GZIP);
		}

		// Write cached file
		if ($this->settings["disk_cache"]) {
			@file_put_contents($cacheFile, $buffer);
		}

		// Stream contents to client
		echo $buffer;
	}
415360
public function handleRequest($redirected = false)
	{
    	if ($this->state < self::STATE_HANDLING) {
        	$this->executeHandlers();
        	$this->state = self::STATE_REQUEST;
    	}

    	$authorized = true;

    	if ($this->getRouter()->hasRoute()) {
			if ($this->getRouter()->isRouteAllowed()) {
				// Create a new request
				$this->setRequest(new Request($this, $this->getRouter()->getRoute()));

				// Don't handle the login in case of a redirect
				if ($redirected === false) {
					$this->getRequest()->handleLoginRequest();
				}

				$this->handleUser();

				$authorized = $this->getRequest()->isRouteAuthorized();
				if ($authorized === true) {
					$this->getRequest()->handleController();
					$this->getRequest()->handleRequest();
				}
			} else $this->getResponse()->hardExit(Response::CODE_405);
    	} else $this->getResponse()->hardExit(Response::CODE_404);

    	if ($authorized === true) {
			if ($this->state < self::STATE_DONE) {
				$this->state = self::STATE_DONE;
			}
		} else {
			$this->getRouter()->redirect($authorized);
			$this->handleRequest(true);
		}
    }
80997
public function handle()
    {
        switch (strtolower($_SERVER['QUERY_STRING'])){
        case 'wsdl':
            $this->intoStruct();
            $this->handleWSDL();
            break;
        case 'disco':
            $this->intoStruct();
            $this->handleDISCO();
            break;
        default:
            $this->intoStruct();
            if (isset($_SERVER['HTTP_SOAPACTION'])) {
                $this->createServer();
            } elseif (isset($_REQUEST['svc'])) {
               	$this->handleHTTP(); // by JG
            } else {
                $this->handleINFO();
            }
            break;
        }
    }
806492
public function handleRequest()
    {
        // Create the request very early so the Resource Management has a chance to grab it:
        $this->request = Request::createFromEnvironment();
        $this->response = new Response();

        $this->checkBasicRequirementsAndDisplayLoadingScreen();

        $this->boot();
        $this->resolveDependencies();
        if (isset($this->settings['http']['baseUri'])) {
            $this->request->setBaseUri(new Uri($this->settings['http']['baseUri']));
        }

        $componentContext = new ComponentContext($this->request, $this->response);
        $this->baseComponentChain->handle($componentContext);

        $this->baseComponentChain->getResponse()->send();

        $this->bootstrap->shutdown('Runtime');
        $this->exit->__invoke();
    }
1103637
public function handler(): Response
    {
        $logoFile = $this->request->files->get('logo');
        $filename = ShortUuid::uuid4() . '.' . $logoFile->guessExtension();
        $directory = app()->getStoragePath() . '/public';
        $logoFile->move($directory, $filename);
        $config = Config::findBy(['key' => 'logo']);
        $config->value('/storage/' . $filename);
        $config->save();
        $this->log('info', 'Upload config.logo to [' . $config->getValue() . ']');
        return response();
    }
925913
public function handleRequest(): self
    {
        if ($this->params->getBotParam('webhook.url')) {
            return $this->handleWebhook();
        }

        if ($loop_time = $this->getLoopTime()) {
            return $this->handleGetUpdatesLoop($loop_time, $this->getLoopInterval());
        }

        return $this->handleGetUpdates();
    }
185621
public function handleRequest()
    {
        list($route, $target) = $this->bootForRequest();

        $response = $this->runRequest($route, $target);

        $this->sendResponse($response);

        $this->terminateRequest();
    }
1038827
public function redirect() : ?RedirectResponse
    {
        if (!$this->enabled()) {
            return null;
        }

        return redirect()
            ->back()
            ->withErrors([
                'form-verify-error' => $this->redirectMessage,
            ])
            ->withInput();
    }
1047657
public function redirect()
    {
        $this->request->getSession()->set(
            'oauth.temp', $temp = $this->server->getTemporaryCredentials()
        );

        return new RedirectResponse($this->server->getAuthorizationUrl($temp));
    }
1102076
public function handle()
    {
        // get information about the REST-request
        $this->get();

        if ($this->requestMethod === 'GET' && $this->typo3Cache->hasCacheEntry($this->url, $_GET)) {
            return $this->handleRequestByTypo3Cache();
        }

        // if no cache exist: restler should handle the request
        return parent::handle();
    }
1335781
public function index(HTTPRequest $request)
    {
        /** @var RedirectorPage $page */
        $page = $this->data();
        if (!$this->getResponse()->isFinished() && $link = $page->redirectionLink()) {
            $this->redirect($link, 301);
        }
        return parent::handleAction($request, 'handleIndex');
    }
848935
public function redirect()
    {
        if (!$this->app->utilities->page->is('search')) {
            return;
        }

        if (!$this->searchQuery()) {
            return;
        }

        global $wp_rewrite;

        if (!$wp_rewrite->using_permalinks()) {
            return;
        }

        \wp_redirect(\get_search_link(), 301);

        exit;
    }
715905
public function handleRequest()
    {
        // test if user has selected an idp or idp can be deremine automatically somehow.
        $this->start();

        // no choice possible. Show discovery service page
        $idpList = $this->getIdPList();
        if (isset($this->originalsp['disco.addInstitutionApp'])
            && $this->originalsp['disco.addInstitutionApp'] === true
        ) {
            $idpList = $this->filterAddInstitutionList($idpList);
        } else {
            $idpList = $this->filterList($idpList);
        }
        $preferredIdP = $this->getRecommendedIdP();
        $preferredIdP = array_key_exists($preferredIdP, $idpList)
            ? $preferredIdP : null;

        if (sizeof($idpList) === 1) {
            $idp = array_keys($idpList)[0];
            $url = Disco::buildContinueUrl(
                $this->spEntityId,
                $this->returnURL,
                $this->returnIdParam,
                $idp
            );
            Logger::info('perun.Disco: Only one Idp left. Redirecting automatically. IdP: '
                . $idp);
            HTTP::redirectTrustedURL($url);
        }

        $t = new DiscoTemplate($this->config);
        $t->data['originalsp'] = $this->originalsp;
        $t->data['idplist'] = $this->idplistStructured($idpList);
        $t->data['preferredidp'] = $preferredIdP;
        $t->data['entityID'] = $this->spEntityId;
        $t->data['return'] = $this->returnURL;
        $t->data['returnIDParam'] = $this->returnIdParam;
        $t->data['AuthnContextClassRef'] = $this->authnContextClassRef;
        $t->show();
    }
225316
public function filter()
    {
        $this->updateFilters()
             ->checkActivePage();

        $previousUrl = app('url')->previous();
        $previousUrl = $this->removePageQueryFromUrl($previousUrl);

        return redirect()->to($previousUrl);
    }
240693
public function redirect()
    {
        if (isset($_GET['template']) === false) {
            return redirect($this->router->generate('navigations-page'));
        } else {
            return 'Redirect: ' . $this->router->generate('navigations-page');
        }
    }
229371
public function handleRequest()
    {
        try {
            $rtn = parent::handleRequest();

            if (extension_loaded('newrelic')) {
                $site = $this->toPhpName($this->config->get('site.name'));
                $controller = $this->toPhpName($this->route['controller']);
                $action = $this->toPhpName($this->route['action']);

                newrelic_name_transaction($site . '.' . $controller . '.' . $action);
            }
        } catch (HttpException\NotFoundException $ex) {
            $rtn = $this->handleHttpError($ex->getErrorCode());
        } catch (HttpException $ex) {
            if ((defined('CMS_ENV') && CMS_ENV == 'development') || array_key_exists('ex', $_GET)) {
                throw $ex;
            }

            $rtn = $this->handleHttpError($ex->getErrorCode());
        } catch (Exception $ex) {
            if ((defined('CMS_ENV') && CMS_ENV == 'development') || array_key_exists('ex', $_GET)) {
                throw $ex;
            }

            $rtn = $this->handleHttpError(500);
        }

        return $rtn;
    }