(rather than returning false, which indicates that this login module should be ignored, which potentially allows authentication to succeed). commit: The identity of the subject has been verified, so code in this method sets up the Principal and Groups (roles) for the successfully authenticated subject. This method has to be written carefully in enterprise applications as Java EE application servers often expect the relationships between the Principal and Group objects to be set up in a certain way. This method should throw a javax.security.auth.login.FailedLoginException if authentication fails (e.g. a user has specified an incorrect login or password). abort: Called if the authentication process itself fails. If this method returns false, then this Login Module is ignored. logout: Code that should be executed upon logout (e.g. could remove the Principal from the Subject or could invalidate a web session). Login modules can provide single sign on (SSO) via a particular SSO protocol/framework (e.g. SAML, OpenID, and SPNEGO), can check for the presence of hardware security tokens (e.g. USB token), etc. In an n-tier application, LoginModules can be present on both the client side and server side. LoginModule (javax.security.auth.spi.LoginModule) Login modules are written by implementing this interface; they contain the actual code for authentication. It can use various mechanisms to authenticate user credentials. The code could retrieve a password from a database and compare it to the password supplied to the module. LoginContext (javax.security.auth.login.LoginContext) The login context is the core of the JAAS framework which kicks off the authentication process by creating a Subject. As the authentication process proceeds, the subject is populated with various principals and credentials for further processing. Subject (javax.security.auth.Subject) A subject represents a single user, entity or system –in other words, a client– requesting authentication. Principal (java.security.Principal) A principal represents the face of a subject. It encapsulates features or properties of a subject. A subject can contain multiple principals. Credentials Credentials are nothing but pieces of information regarding the subject in consideration. They might be account numbers, passwords, certificates etc. As the credential represents some important information, the further interfaces might be useful for creating a proper and secure credential – javax.security.auth.Destroyable and javax.security.auth.Refreshable. Suppose that after the successful authentication of the user you populate the subject with a secret ID (in the form of a credential) with which the subject can execute some critical services, but the credential should be removed after a specific time. In that