Software AG Products 10.11 | Administering Integration Server | Customizing Authentication Using JAAS | JAAS Custom Login Module Example | JAAS Custom Login Module: Code Explanation
 
JAAS Custom Login Module: Code Explanation
The following table summarizes the key code portions of a custom JAAS login module in the above sample module.
Code Portion
Description
1.
Imported classes; the first is an Oracle Java class and next three are the Software AG classes from the sin-common.jar in Software AG_directory \common\lib.
2.
Identifies the JAAS custom login module as an extension of SagAbstractLoginModule.
3.
The user ID derived from authentication.
4.
If the login context's overall authentication fails, this method aborts the login.
If the authentication attempt by the login module is successful, then this method cleans up any state information that was originally saved.
5.
This block of code shows the implementation of commit described in Implement Commit(). The commit method returns "true" if a SagUserPrincipal is created by this login module, and it returns "false" if the login module should be ignored.
6.
Initializes the custom JAAS login module.
7.
Attempts to authenticate the user by retrieving the credentials from the given com.softwareag.security.jaas.log.SagCredentials object. During the commit phase, SagAbstractLoginModule creates a principal using the user name identified in the SagCredentials object. If the current user name in the SagCredentials object is not the one to be used, use the sagcredentials.setUserName(string) method to update it with the correct user name.
For simplification, the method specifies a hard-coded user name and password.