Wednesday, 31 July 2013

AutoLogin and Custom Authenticator in Liferay

AutoLogin and Custom Authenticator in Liferay


Nothing can be simpler than implementing AutoLogin and Custom Authenticator in Liferay. Following is the "How-To"
  1. Create a Hooks Project
  2. Put the following properties in portal.properties file in your hooks project
    1. auth.pipleline.pre=com.mslc.authenticators.EMMAuthenticator
    2. auto.login.hooks=com.mslc.authenticators.EMMAutoLogin
    3. auto.login.ignore.paths=/web/guest.home  (optional)
  3. Then create the classes configured
  4. EMMAuthenticator must implement com.liferay.portal.security.auth.Authenticator
  5. EMMAutoLogin must implement com.liferay.portal.security.auth.AutoLogin
  6. EMMAuthenticator must return an int. If it returns Authenticator.SUCCESS then the authentication is passed or else if it returns Authenticator.FAILURE then it has failed.
  7. EMMAutoLogin must return a String[]. The array must contain 3 elements
    1. userId
    2. password
    3. true or false (string format ofcourse) to indicate whether the password is encrypted or not

No comments:

Post a Comment