Friday, March 28, 2014

Liferay Parameter Auto Login


Liferay Parameter Auto Login is one of the mechanisms to login into liferay portal using simple URL and it allows to user can login simple by click some URL link and no need of sign in portlet.

What is Auto login in liferay?

Auto login is mechanism to login into liferay portal without provide user credential for each time login. Liferay provide different mechanisms.

The following are important Auto Login Mechanisms in Liferay

CAS Auto Login:

With help of this user will be authenticated by CAS at one time and next login user can directly login into without asking credentials.

Remember me Auto Login:

This also another one when user first login we liferay will store credentials in cookies when user next login then it automatically login.

Ntlm Auto Login:

 This login uses the computer user name and password to login into liferay it need AD server support.

Parameter Auto Login:

This will allow user login with help of URL.We need construct simple URL with appropriate query string and that query string should have login parameters.

Parameter Auto Login Implementation:
  1. Add Parameter Auto Login class in the list auto.login.hooks
  2. Check
  3. Construct Login URL with appropriate parameters as query string

Add Parameter Auto Login class in the list auto.login.hooks :

Liferay already have Parameter Auto Login class to achieve parameter auto login so that we can use this class to enable parameter auto login.

We need to add this class in the list auto.login.hooks so that we can enable parameter auto login.

By default parameter auto login not enabled so we need to enable by adding Parameter Auto Login in the list auto.login.hooks .

We need to override auto.login.hooks   portal property by using portal-ext.properites file or simply create Liferay Hook Plugin and override the property

Default Property,,,,,,


In the above list we don’t have Parameter Auto login class.
Now Override auto.login.hooks with help of Liferay Hook Plugin or simply use file which is available in Liferay Home directory.

The following is overridden auto.login.hooks property,,,,,,,


Now we need to check based on this we need to pass userId, email address or screen name as login parameters.

Based on desired login parameter we need to override the above property and by default its email address for liferay portal.

If we want change then we need to override above property with the help of Liferay Hook Plugin or file

The following is property available by default

    # The portal can authenticate users based on their email address, screen
    # name, or user id.


If we want change authentication type simply uncomments for required property and comment the current property this can be done from either portal-ext.properies or Liferay Hook Plugin.

Construct Login URL with appropriate parameters as query string

Once we have done above 2 steps then we need to construct Login URL with appropriate parameters in query string.

Parameter Auto login use the two parameters parameterAutoLoginLogin, parameterAutoLoginPassword to construct URL.

Based on we need to pass appropriate values like userId/emailAddress/screenName and password.

Example URL for authentication type Email Address

Example URL for Authentication type userId

Example URL for Authentication type Screen Name


When we hit above URLs in web browser then user automatically login to portal. Here we don’t need of sign in portlet to login.

Important points:

Here we simple use plain user name and password and this is not secured mechanism but we will use some encryption mechanism to encrypt user name and password.

Once it reaches Parameter Auto Login class there we decrypt the data and do the authentication. For this we need to customize the Parameter Auto Login class accordingly.


Popular Posts

Recent Posts

Recent Posts Widget