The code below given is an example of JAAS client where:

  • The username, password, and URL are read as input arguments from the command line
  • Connection to the URL is made, and the client is authenticated using the given username and password
  • A privileged action is executed under the newly implemented authenticated subject

LoginModule Implementation in JAAS

  • The LoginModule interface should be implemented to perform authentication
  • More than one login module can be used at a time and JAAS logs in through each of them
  • Depending upon various successful attempts, JAAS can be made to allow or deny logins

LoginModule implements 5 methods in its interface namely:

  • Initialize()
  • Commit()
  • Login()
  • Logout()
  • Abort()

LoginModule Implementation in JAAS (Cont’d)

Implementation Methods

Methods Associated with LoginModule

LoginModules in J2SE