The JAAS login uses a callback handler to get authentication information from users. The CallbackHandler is specified in the constructor of the LoginContext object. In this tutorial, the callback handler employs several prompts to get username and password information from the user. The handler's handle() method, which is called from a login module, takes an array of Callback objects as its parameter. During login, the handler iterates through the array of Callbacks. The handle() method examines the type of the Callback object and performs the appropriate user action. Callback types are as follows:
- NameCallback
- PasswordCallback
- TextInputCallback
- TextOutputCallback
- LanguageCallback
- ChoiceCallback
- ConfirmationCallback
In some applications, no user interaction is required because JAAS will be used to interface to the operating system's authentication mechanism. In such cases, the CallbackHandler parameter in the LoginContext object will be null.