Friday, March 28, 2014

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 Plugin and 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.hooks with 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.hooks 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, com.liferay.portal.security.auth.ParameterAutoLogin



Check company.security.auth.type

Now we need to check company.security.auth.type 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 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, parameterAutoLoginPassword to construct URL.

Based on company.security.auth.type 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




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

5 comments :

  1. After reading your article I was amazed. I know that you explain it very well. And I hope that other readers will also experience how I feel after reading your article. SKYWESTONLINE login

    ReplyDelete
  2. I simply want to tell you that I am new to weblog and definitely liked this blog site. Very likely I’m going to bookmark your blog . You absolutely have wonderful stories. Cheers for sharing with us your blog. 2021 Winnebago Micro Minnie 2306BHS

    ReplyDelete
  3. Good website! I truly love how it is easy on my eyes it is. I am wondering how I might be notified whenever a new post has been made. I have subscribed to your RSS which may do the trick? Have a great day! voom sign in

    ReplyDelete
  4. There are a few motivations behind why the quantity of windshield chip fixes and break fixes have expanded in the course of the most recent couple of years.www.cprautoglassrepair.com
    cprautoglassrepair.com

    ReplyDelete

Recent Posts

Recent Posts Widget

Popular Posts