Custom LoginModule

The custom login module class must be extended from CelmAbstractLoginModule abstract base class.

The CelmAbstractLoginModule class wraps LoginModule methods such as login() and delegates the method to doLogin(). The custom login module class should override the methods of the abstract class such as doLogin() or doCommit() to provide customized authentication processing. Any resource allocation should be cleaned up in the doLogout() or doAbort() methods.

Example doLogin() Method of a Custom LoginModule

The following is an example of doLogin() of a custom LoginModule:

/**
* Perform login.
* This method is called when login() in LoginModule is called.
*
*/
@Override
public boolean doLogin() throws LoginException
{
if (getMessageElement() != null)
extractUsernamePassword(getMessageElement().getOwnerDocument());
return authenticateUsernamePassword(getUsername(), getPassword());
}

Refer to Sample Custom LoginModule for a complete sample custom login module class.