Extending the AMLoginModule Class

Custom authentication modules extend the com.sun.identity.authentication.spi.AMLoginModule class. The class must also implement the init(), process() and getPrincipal() methods
in order to communicate with the authentication module configuration
files. The callbacks are then dynamically generated based on this
file. Other methods that can be defined include setLoginFailureURL and setLoginSuccessURL which defines
URLs to send the user to based on a failed or successful authentication,
respectively.

Note –

To make use of the account locking feature with custom
authentication modules, the InvalidPasswordException exception
should be thrown when the password is invalid.