Foren

Facing problem in logging into liferay when auto login hook is used.

subhash Peddyreddy, geändert vor 8 Jahren.

Facing problem in logging into liferay when auto login hook is used.

New Member Beiträge: 14 Beitrittsdatum: 21.09.15 Neueste Beiträge
Hi,
Could any one of you help me please with this issue, I am using jsf 2 with liferay 6.2 to develop my project.
I have an Auto-Login Hook whose code is like this.

Auto-Login hook - login method is like this
---------------
@Override
public String[] login(HttpServletRequest request,
HttpServletResponse response) throws AutoLoginException {
String loginPagePath = /web/mysite/register;
String userName = request.getHeader("TVS_USER_NAME");

if (!StringUtils.isEmpty(userName)) {
//Process and auto-login
}
return new String[] {};
}

Post-Login
----------
@Override
public void run(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse)
throws ActionException {

HttpSession httpSession = httpServletRequest.getSession(false);
String loggedInUser = (String)httpSession.getAttribute(WebKeys.USER);
if(Validator.isNull(loggedInUser)){
httpSession.invalidate();
}
}

portal-ext.properties
------------------------------
#Liferay property for setting the theme's shorcut/favicon icon.
theme.shortcut.icon=ro-favicon-wit-0xffffff.png

#Liferay property for accepting the https requests
#web.server.protocol=https

#The default home URL of the portal.
virtual.hosts.default.site.name=mysite

#Set the following to true if the portal should show HTTP status codes like 404 if the requested page is not found.
layout.show.http.status=true
layout.friendly.url.page.not.found=/web/mysite/register

#Liferay settings for ignoring the redirected path from blocking
auto.login.ignore.paths=/web/mysite/register

#Liferay public pages
mysite.public.welcome.page = /web/mysite/welcome
mysite.public.register.page = /web/mysite/register

#Removing all the session values stored in the servlet cache
com.liferay.portal.servlet.filters.cache.CacheFilter=false
com.liferay.portal.servlet.filters.etag.ETagFilter=false
com.liferay.portal.servlet.filters.header.HeaderFilter=false

#Set this to true if you want the portal to force the browser cache to be disabled.
#It will only disable the cache for the rendered HTML response It will not have an impact
#on static content or other resources.
browser.cache.disabled=true

#Set this true if you want to disable the cache for authenticated users.
#This property is not read when the property "browser.cache.signed.in.disabled" is true.
#This is useful to ensure that authenticated users cannot go to the sign in page by clicking on the back
#button in their browsers.
browser.cache.signed.in.disabled=true

#Remove the session id in the url
session.enable.url.with.session.id=false

#Session time setting for expiry
session.timeout=30
session.timeout.auto.extend=false
session.timeout.redirect.on.expire=true
default.logout.page.path=/

My Issue
----------
I have a custom theme applied to all my public (welcome, register) and private (actions, search) pages of my site.
Welcome - Sign in portlet of Liferay
Register - custom registration portlet
actions - custom actions portlet
search - custom search portlet

I have deployed the same code in development and testing environments.

If i go to the welcome page of my site i am able to login into the liferay as an administrator in development environment without any issue.
If i try to do the same thing in test envirnoment its not allowing me to login as an administrator but all the times it redirects me to the same login page and i dont see any error
in the log file.

Have i done any thing wrong may be in the properties file etc.

Could any one please check once and help me out in resolving this issue

Thanks & Regards
Subhash Reddy P
thumbnail
Kyle Joseph Stiemann, geändert vor 8 Jahren.

Moved.

Liferay Master Beiträge: 760 Beitrittsdatum: 14.01.13 Neueste Beiträge
Moved to Home » Liferay Faces » Liferay Faces - English.
thumbnail
Philip White, geändert vor 8 Jahren.

RE: Facing problem in logging into liferay when auto login hook is used.

Junior Member Beiträge: 76 Beitrittsdatum: 11.03.15 Neueste Beiträge
hello Subhash,

If you are using Tomcat, then you can try the following demo portlet in your environment and let us know if it works.

Hope this helps!

Phil
subhash Peddyreddy, geändert vor 8 Jahren.

RE: Facing problem in logging into liferay when auto login hook is used.

New Member Beiträge: 14 Beitrittsdatum: 21.09.15 Neueste Beiträge
Hi Philip,
Thank you for the reply.
I found the reason for liferay not allowing me to login into it with any user credentials.
Actually for security constraint i have added secure flag and http-only flag as shown below in session-config present in web.xml, so liferay is not accepting my login request and failing to redirect. I have added this block for making every session cookie a secure one as per the standards.
<session-config>
<session-timeout>30</session-timeout>
<cookie-config>
<http-only>true</http-only>
<secure>true</secure>
</cookie-config>
</session-config>

The above setting is same as "web.server.protocol=https" in being added in portlet-ext. properties i guess and i am not sure.

Now the problem is how to login into the liferay without removing these secure flag from web.xml and https property from portal-ext.properties in the same machine.

Can any one guide me in doing this, as i cannot ask the deployment team each time to uncomment these and restart the server for doing some administration changes in the liferay portal.

Thanks & Regards
Subhash Reddy P.
thumbnail
Juan Gonzalez, geändert vor 8 Jahren.

RE: Facing problem in logging into liferay when auto login hook is used.

Liferay Legend Beiträge: 3089 Beitrittsdatum: 28.10.08 Neueste Beiträge
Hiu subhash,

do you access your development server using "localhost"/127.0.0.1?
subhash Peddyreddy, geändert vor 8 Jahren.

RE: Facing problem in logging into liferay when auto login hook is used.

New Member Beiträge: 14 Beitrittsdatum: 21.09.15 Neueste Beiträge
Hi,
I do access my development server using localhost:8080.
thumbnail
Juan Gonzalez, geändert vor 8 Jahren.

RE: Facing problem in logging into liferay when auto login hook is used.

Liferay Legend Beiträge: 3089 Beitrittsdatum: 28.10.08 Neueste Beiträge
Then can you try adding the host IP (not 127.0.0.1) in your portal-ext.properties?:

redirect.url.ips.allowed
subhash Peddyreddy, geändert vor 8 Jahren.

RE: Facing problem in logging into liferay when auto login hook is used.

New Member Beiträge: 14 Beitrittsdatum: 21.09.15 Neueste Beiträge
Hi Juan,
Sure i will try this and let you know the result.

Thank you very much.