posted 20 years ago
I have a JAAS framework setup within my application and everything works well as long as you log in correctly. I have the typical setup:
try {
CallbackHandler callbackHandler = new LoginScreen();
LoginContext context = new LoginContext("AppName", callbackHandler);
context.login();
} catch (LoginException e) {
// The world blows up
}
So my CallbackHandler (LoginScreen) gets its array of callbacks. I pop up a little dialog and have the user enter in their username and password and then when they hit the ok button, I populate the appropriate callbacks, dispose of the dialog and then let the LoginModules do their little magic.
My problem is that I really don't want to close the dialog box unless they have either logged in correctly or logged in incorrectly 3 times. So how does my callback handler know whether the login succeeded or not? I can think of a million messy ways to accomplish this, but I was wondering if anyone had a clean solution to this problem?
Thanks,
-Phil