process() is called to perform the actual authentication. For example, it may prompt for a user name and password, and then attempt to verify the credentials. If your module requires user interaction (for example, retrieving a user name and password), it should not do so directly. This method should invoke the handle method of the javax.security.auth.callback.CallbackHandler interface to retrieve and display the appropriate callbacks. The AMLoginModule then internally passes the callback values to the Distributed Authentication User Interface which performs the requested authentication.
Consider the following points while writing the process() method:
Perform the authentication and if successful, save the authenticated principal.
Return -1 if authentication succeeds.
Throw an exception, such as AuthLoginException, if authentication fails or return the relevant state specified in the module's configuration properties file
Throw an exception, such as InvalidPasswordException, if using the Login Failure Lockout feature
If multiple states are available to the user, the Callback array from a previous state may be retrieved by using the getCallback() method. The underlying login module keeps callback information from previous states until the login process is completed.
If a module needs to substitute dynamic text (generate challenges, passwords or user identifiers) in the next state, use the getCallback() method to retrieve the callback for the next state, modify the text, and call replaceCallback() to update the array.
Each authentication session will create a new instance of your module's Java class. The reference to the class will be released once the authentication session has either succeeded or failed.
Any static data or reference to any static data in your module must be thread-safe.