private boolean requestCredentialsAndAuthenticate(Callback[] callbacks) throws LoginException
    {
        boolean authenticated = false;

        try
        {
            callbackHandler.handle(callbacks);

            username = ((NameCallback) callbacks[0]).getName();
            password = loadPassword((PasswordCallback) callbacks[1]);
            if (username == null || password.length == 0)
            {
                LOG.error("Callback handler does not return login data properly");
                throw new LoginException("Callback handler does not return login data properly");
            }

            JdbcAuthenticationService authService = initAuthenticationService();
            authenticated = authService.authenticate(username, new String(password));
        }
        catch (IOException ex)
        {
            LOG.error("Error during user login", ex);
            throw new LoginException(ex.toString());
        }
        catch (UnsupportedCallbackException ex)
        {
            String msg = MessageFormat.format("{0} not available to garner authentication information from the user", ex
                    .getCallback().toString());

            LOG.error(msg);
            throw new LoginException("Error: " + msg);
        }

        return authenticated;
    }