@Override
    public boolean login() throws LoginException
    {
        if (debug)
        {
            LOG.debug("login...");
        }

        if (callbackHandler == null)
        {
            LOG.error("Error: no CallbackHandler available");
            throw new LoginException("Error: no CallbackHandler available");
        }

        Callback[] callbacks = new Callback[2];
        callbacks[0] = new NameCallback("username");
        callbacks[1] = new PasswordCallback("password", false);

        succeeded = requestCredentialsAndAuthenticate(callbacks);

        if (!succeeded)
        {
            LOG.info("login failed");
            throw new FailedLoginException("login failed");
        }

        if (debug)
        {
            LOG.debug("authentication succeeded");
        }

        return succeeded;
    }