protected function _login($username, $password, $application)
    {
        // If we did receive the user credentials from the user, try to login
        if($application->login(array('username' => $username, 'password' => $password)) !== true) {
            return false;
        }

        // If we have logged in succesfully, make sure to fullfil
        // Koowa's CSRF authenticator checks if the framework is loaded.
        if (class_exists('Koowa'))
        {
            $manager = KObjectManager::getInstance();

            $request = $manager->getInstance()->getObject('com:koowa.dispatcher.request');
            $user    = $manager->getInstance()->getObject('user');
            $token   = $user->getSession()->getToken();

            $request->setReferrer(JUri::root());
            $request->getHeaders()->add(array('X-Xsrf-Token' => $token));
            $request->getCookies()->add(array('csrf_token' => $token));
        }

        return true;
    }