logFile = info.resolve(name);
handler = callbackHandler;
}
public boolean login() throws LoginException {
NameCallback user = new NameCallback("User name:");
Callback[] callbacks = new Callback[]{user};
try {
handler.handle(callbacks);
} catch (Exception e) {
throw (LoginException)new LoginException("Unable to process callback: "+e.getMessage()).initCause(e);
}
if(callbacks.length != 1) {
throw new IllegalStateException("Number of callbacks changed by server!");
}
user = (NameCallback) callbacks[0];
username = user.getName();
writeToFile("Authentication attempt");
return false;
}