public function processAuthentication($route, $request)
    {
        if (\App::isDownForMaintenance()) {
            return $this->jsonErrorResponse("We're currently down for maintenance.", 503);
        }

        $user = null;

        try {
            $credentials = array(
                'login'    => Request::server('PHP_AUTH_USER'),
                'password' => Request::server('PHP_AUTH_PW'),
            );

            $user = Subbly::api('subbly.user')->authenticate($credentials, false);
        } catch (\Exception $e) {
            if (in_array(get_class($e), array(
                'Cartalyst\\Sentry\\Users\\UserNotActivatedException',
                'Cartalyst\\Sentry\\Users\\UserSuspendedException',
                'Cartalyst\\Sentry\\Users\\UserBannedException',
            ))) {
                return $this->jsonErrorResponse($e->getMessage());
            } elseif (in_array(get_class($e), array(
                'Cartalyst\\Sentry\\Users\\LoginRequiredException',
                'Cartalyst\\Sentry\\Users\\PasswordRequiredException',
                'Cartalyst\\Sentry\\Users\\WrongPasswordException',
                'Cartalyst\\Sentry\\Users\\UserNotFoundException',
            ))) {
                // do not return basic auth if AJAX
                $httpHeaders = Request::ajax()
                    ? array()
                    : array('WWW-Authenticate' => 'Basic realm="Subbly authentication"')
                ;

                return $this->jsonErrorResponse('Auth required! Something is wrong with your credentials.', 401, $httpHeaders);
            }

            return $this->jsonErrorResponse('FATAL ERROR!', 500);
        }

        if (!$user instanceof User || !$user->hasAccess('subbly.backend.auth')) {
            return $this->jsonErrorResponse('Access refused! You have not the premission to access this page.', 401);
        }
    }