Liferay Parameter Auto Login

Introduction:

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 company.security.auth.type
  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 Pluginand override the property

Default Property

auto.login.hooks=com.liferay.portal.security.auth.CASAutoLogin,
com.liferay.portal.security.auth.FacebookAutoLogin,
com.liferay.portal.security.auth.NtlmAutoLogin,
com.liferay.portal.security.auth.OpenIdAutoLogin,
com.liferay.portal.security.auth.OpenSSOAutoLogin,
com.liferay.portal.security.auth.RememberMeAutoLogin,
com.liferay.portal.security.auth.SiteMinderAutoLogin

Note:

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

The following is overridden auto.login.hooksproperty


auto.login.hooks=com.liferay.portal.security.auth.CASAutoLogin,
com.liferay.portal.security.auth.FacebookAutoLogin,
com.liferay.portal.security.auth.NtlmAutoLogin,
com.liferay.portal.security.auth.OpenIdAutoLogin,
com.liferay.portal.security.auth.OpenSSOAutoLogin,
com.liferay.portal.security.auth.RememberMeAutoLogin,
com.liferay.portal.security.auth.SiteMinderAutoLogin, com.liferay.portal.security.auth.ParameterAutoLogin



Check company.security.auth.type

Now we need to check company.security.auth.typebased 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 portal-ext.properties file

The following is property available by default


    # The portal can authenticate users based on their email address, screen
    # name, or user id.
    #
    company.security.auth.type=emailAddress
    #company.security.auth.type=screenName
    #company.security.auth.type=userId


Note:

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, parameterAutoLoginPasswordto construct URL.

Based on company.security.auth.typewe need to pass appropriate values like userId/emailAddress/screenNameand password.

Example URL for authentication type Email Address




Example URL for Authentication type userId




Example URL for Authentication type Screen Name




Note:

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.


Author
Share on Google Plus

About Meera Prince

This is a short description in the author block about the author. You edit it by entering text in the "Biographical Info" field in the user admin panel.
    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment