abort

boolean abort() throws LoginException;

The abort method is called to abort the authentication process. This is phase 2 of authentication when phase 1 fails. It is called if the LoginContext's overall authentication failed.

This method first accesses this LoginModule's authentication result and corresponding authentication state saved by the login (and possibly commit) methods, and then clears out and destroys the information. Sample state to destroy would be user names and passwords.

If this LoginModule's authentication attempt failed, then there shouldn't be any private state to clean up.

The following tables depict what a LoginModule's abort method should return. This first table assumes that the previous call to login succeeded. For instance, the second cell of the third row depicts what the abort method should return if both the previous call to login and commit succeeded, and the abort method itself also succeeded.
Table 1. Results of the abort method if the login method succeeds
COMMIT ABORT
SUCCESS FAILURE
SUCCESS return TRUE throw EXCEPTION
FAILURE return TRUE throw EXCEPTION
The second table depicts what a LoginModule's abort method should return, assuming that the previous call to login failed. For instance, the second cell of the third row depicts what the abort method should return if the previous call to login failed, the previous call to commit succeeded, and the abort method itself also succeeded.
Table 2. Results of the abort method if the login method fails
COMMIT ABORT
SUCCESS FAILURE
SUCCESS return FALSE return FALSE
FAILURE return FALSE return FALSE