public function handleViolation(Route $route)
    {

        if(in_array($route, $this->violatingRoutes)) {
            throw new ApplicationException('Circular redirects detected; aborting.');
        }

        // to avoid circular references all redirects are logged

        $this->violatingRoutes[] = $route;

        Session::getSessionDataBag()->set('authViolatingRequest', Request::createFromGlobals());

        if($redirect = $route->getRedirect()) {
            return Application::getInstance()->getRouter()->getRoute($redirect);
        }

        else {
            throw new \RuntimeException(sprintf("No redirect configured for route '%s', which cannot be authenticated.", $route->getRouteId()));
        }

    }
public function handleViolation(Route $route)
    {

        if(in_array($route, $this->violatingRoutes)) {
            throw new ApplicationException('Circular redirects detected; aborting.');
        }

        // to avoid circular references all redirects are logged

        $this->violatingRoutes[] = $route;

        Session::getSessionDataBag()->set('authViolatingRequest', Request::createFromGlobals());

        if($redirect = $route->getRedirect()) {
            return Application::getInstance()->getRouter()->getRoute($redirect);
        }

        else {
            throw new \RuntimeException(sprintf("No redirect configured for route '%s', which cannot be authenticated.", $route->getRouteId()));
        }

    }
public function handleViolation ( Route $ route ) { if ( in_array ( $ route , $ this -> violatingRoutes ) ) { throw new ApplicationException ( 'Circular redirects detected; aborting.' ) ; } // to avoid circular references all redirects are logged $ this -> violatingRoutes [ ] = $ route ; Session :: getSessionDataBag ( ) -> set ( 'authViolatingRequest' , Request :: createFromGlobals ( ) ) ; if ( $ redirect = $ route -> getRedirect ( ) ) { return Application :: getInstance ( ) -> getRouter ( ) -> getRoute ( $ redirect ) ; } else { throw new \ RuntimeException ( sprintf ( "No redirect configured for route '%s', which cannot be authenticated." , $ route -> getRouteId ( ) ) ) ; } }
handle authentication violation by trying to find a redirecting route

@param Route $route
@return mixed|Route
@throws \vxPHP\Application\Exception\ApplicationException
handle authentication violation by trying to find a redirecting route