@Override public boolean login() throws LoginException { Callback[] callbacks = new Callback[2]; callbacks[0] = new NameCallback("Username: "******"Password: "******" not available to obtain information from user"); } user = ((NameCallback) callbacks[0]).getName(); char[] tmpPassword = ((PasswordCallback) callbacks[1]).getPassword(); if (tmpPassword == null) { tmpPassword = new char[0]; } if (user == null) { if (configuration.getDefaultUser() == null) { throw new FailedLoginException("Both username and defaultUser are null"); } else { user = configuration.getDefaultUser(); } } else { String password = configuration.getUser(user) == null ? null : configuration.getUser(user).getPassword(); if (password == null) { throw new FailedLoginException("User does not exist"); } if (!password.equals(new String(tmpPassword))) { throw new FailedLoginException("Password does not match"); } } loginSucceeded = true; logger.debug("login " + user); return loginSucceeded; }