Handles passowrd token before dispatching.

(non-PHPdoc)

@see ComBaseDispatcherDefault::_actionDispatch()
349654
protected function _actionDispatch(AnCommandContext $context)
    {
        if (
            $this->getController()->getIdentifier()->name === 'session' &&
            $this->token != ''
        ) {
            $this->getController()->execute('tokenlogin', $context);
            $context->response->send();
            exit(0);
        }

        return parent::_actionDispatch($context);
    }
167291
public function dispatchAction($controller)
    {
        $action = $this->matchRoute[key($this->matchRoute)]['action'] . 'Action';

        $viewModel = $controller->$action();

        if ($viewModel instanceof ViewModel) {
            $this->view->setVariables($viewModel->getVariables());
        }
    }
684232
protected function handleDispatcherResponse($routeInfo)
    {
        switch ($routeInfo[0]) {
            case Dispatcher::NOT_FOUND:
                throw new NotFoundHttpException();
            case Dispatcher::METHOD_NOT_ALLOWED:
                throw new MethodNotAllowedHttpException($routeInfo[1]);
            case Dispatcher::FOUND:
                return $this->handleFoundRoute($routeInfo);
        }
    }
595085
public void dispatch(Request request, Response response) throws IOException, ServletException {
        onPreDispatch(request, response);
        onRouteDispatch(request, response);
        onPostDispatch(request, response);
    }
284470
public static function dispatch()
    {
        if (self::$force) {
            return null;
        }

        self::forceRender();

        if (self::$views) {
            foreach (self::$views as &$value) {
                $value && self::render($value[0], $value[1]);
            }
        }
    }
191752
public function getAction()
    {
        if (isset($this->uris[1])) {
            $_action = $this->uris[1];
        } else {
            throw new NotFoundException('Cannot dispatch action name.');
        }

        return strip_tags($_action);
    }
1092337
private function _throwDispatchException( $message, $exception_code = 0 )
    {
        $exception = new \Exception( $message, $exception_code );

		if ( is_object($this->_events_manager) )
        {
            /**
             * If the event returns false -> exit and don't throw exception
             */
            if ( $this->_events_manager->fire( "dispatch:beforeException", $this, array("exception" => $exception) ) == false )
            {
                return false;
            }
		}

        throw $exception;
    }
1347594
private function actionKeepDefault() {
        $this->match(Token::T_ACTION, true);

        $action = ltrim($this->lastToken->getText(), '@');
        $this->metadata->addMetadata($action, true);
    }
561667
protected function _actionDispatch(AnCommandContext $context)
    {
        if ($this->action === 'confirm' && $this->token) {
            $context->data->append(array(
               '_action' => 'confirm',
               'token' => $this->token,
            ));

            return $this->execute('post', $context);
        }

        return parent::_actionDispatch($context);
    }
353902
public function forward($controller, $action = null, array $params = array())
    {
        $this->response = $this->dispatch($controller, $action, $params);
        $this->preventPreviousDispatch();
    }
1086388
function startDispatching(action) {
	require('./debug.es6').logDispatch(action);

	Object.keys(this[CALLBACKS]).forEach((id) => {
		this[IS_PENDING][id] = false;
		this[IS_HANDLED][id] = false;
	});

	this[PENDING_ACTION] = action;
	this[IS_DISPATCHING] = true;
}
1371003
public function Gdn_Dispatcher_BeforeDispatch_Handler($Sender) {
      $Enabled = C('Garden.Analytics.Enabled', TRUE);

      if ($Enabled && !Gdn::PluginManager()->HasNewMethod('SettingsController', 'Index')) {
         Gdn::PluginManager()->RegisterNewMethod('VanillaStatsPlugin', 'StatsDashboard', 'SettingsController', 'Index');
      }
   }
1082816
protected function initDispatcher()
    {
        if ($this->isConfigConsistent()) {
            $this->setDispatcher(
                \FastRoute\simpleDispatcher(function (RouteCollector $r) {
                    $r->addRoute('POST', $this->getSaml()->getAcsLocation(), new SamlResponseHandler());
                    $r->addRoute(['POST', 'GET'], $this->getSaml()->getLogoutLocation(), new SamlLogoutHandler());
                    $r->addRoute(['GET'], $this->getConfig()->getAdminPathInfo(), new PingAdminHandler());
                    $r->addRoute(['GET'], $this->getConfig()->getMetadataPathInfo(), new MetadataAdminHandler());
                    $r->addRoute(['DELETE'], $this->getConfig()->getAdminPathInfo(), new DeleteAdminHandler());
                    $r->addRoute(['POST'], $this->getConfig()->getAdminPathInfo(), new RegisterAdminHandler());

                    if ($this->getConfig()->hasProfileAssociationCallback()) {
                        $r->addRoute(
                            'POST',
                            $this->getConfig()->getProfileAssociationPath(),
                            new ProfileAssociationHandler($this->getConfig()->getProfileAssociationCallback())
                        );
                    }
                })
            );
        } else {
            $this->setDispatcher(
                \FastRoute\simpleDispatcher(function (RouteCollector $r) {
                    $r->addRoute(['GET'], $this->getConfig()->getAdminPathInfo(), new PingAdminHandler());
                    $r->addRoute('POST', $this->getConfig()->getAdminPathInfo(), new RegisterAdminHandler());
                })
            );
        }
    }
1019419
public function onDispatch(MvcEvent $e)
    {
        $routeMatch = $e->getRouteMatch();
        if (!$routeMatch) {
            /**
             * @todo Determine requirements for when route match is missing.
             *       Potentially allow pulling directly from request metadata?
             */
            throw new \Zend\Mvc\Exception\DomainException('Missing route matches; unsure how to retrieve action');
        }

        $action = $routeMatch->getParam('action', null);

        if ($action) {
            $action = strtolower($action);
        }

        switch ($action) {
            case 'process':
                $message = $routeMatch->getParam('message', null);

                if($message instanceof MessageInterface) {
                    $result = $this->process($message);
                } else {
                    throw new \InvalidArgumentException(
                        'Missing or invalid message type: must be an instace of '. MessageInterface::class
                    );
                }
                break;

            case 'send':
            case 'receive':
            case 'await':

                $queue = $routeMatch->getParam('queue', null);

                if (is_string($queue)) {
                    $queue = $this->getServiceLocator()->get($queue);
                }

                if (!$queue instanceof QueueClientInterface) {
                    throw new \InvalidArgumentException(
                        'Invalid queue param type: must be a string or an instace of '. QueueClientInterface::class
                    );
                }

                if ($action === 'send') {

                    $message = $routeMatch->getParam('message', null);
                    $parameters = $routeMatch->getParam('sendParameters', null);

                    if ($parameters === null) {
                        $params = null;
                    } else if ($parameters instanceof SendParametersInterface) {
                        $params = $parameters;
                    } else if (is_string($parameters)) {
                        $params = new SendParameters();
                        $params->fromString($parameters);
                    } else if (is_array($parameters)) {
                        $params = new SendParameters();
                        $params->fromArray($parameters);
                    } else {
                        throw new \InvalidArgumentException(
                            'Invalid sendParameters param type: must be null, an array, a string or an instace of '. SendParametersInterface::class
                        );
                    }

                    $result = $this->send($queue, $message, $params);
                } else {

                    $parameters = $routeMatch->getParam('receiveParameters', null);

                    if ($parameters === null) {
                        $params = null;
                    } else if ($parameters instanceof ReceiveParametersInterface) {
                        $params = $parameters;
                    } else if (is_string($parameters)) {
                        $params = new ReceiveParameters();
                        $params->fromString($parameters);
                    } else if (is_array($parameters)) {
                        $params = new ReceiveParameters();
                        $params->fromArray($parameters);
                    } else {
                        throw new \InvalidArgumentException(
                            'Invalid receiveParameters param type: must be null, an array, a string or an instace of '. QueueClientInterface::class
                        );
                    }

                    if ($action === 'receive') {
                        $maxMessages = (int) $routeMatch->getParam('maxMessages', 1);
                        $result = $this->receive($queue, $maxMessages, $params);
                    } else {
                        $result = $this->await($queue, $params);
                    }
                }
                break;

            default:
                throw new \InvalidArgumentException(
                    sprintf('Invalid action "%s". Only "process", "send", "receive", "await" are allowed', $action)
                );
        }


        $e->setResult($result);

        return $result;
    }
1083155
public function onAfterRoute()
    {
        $app = JFactory::getApplication();

        $username = $app->input->server->get('PHP_AUTH_USER', null, 'string');
        $password = $app->input->server->get('PHP_AUTH_PW', null, 'string');

        if ($username && $password)
        {
            if (!$this->_login($username, $password, $app)) {
                throw new Exception('Login failed', 401);
            }
        }
    }
1324585
public function getDispatchAction()
    {
        $params = $this->request->getAll();
        foreach (array_keys($params) as $key) {
            if (preg_match('/^dispatch-(.+)/', $key, $matches)) {
                $action = str_replace('-', '.', $matches[1]);
                return $action;
            }
        }
    }
1173047
protected function _beforeDispatch(DispatcherContext $context)
    {
        // Check if the user has been explicitly authenticated for this request
        if (!$this->getUser()->isAuthentic(true))
        {
            foreach($this->__authenticator_queue as $authenticator)
            {
                if($authenticator->authenticateRequest($context) === true) {
                    break;
                }
            }
        }

    }