Fórum

6.05 AutoLogin not working in 6.1 GA2

thumbnail
William Gosse, modificado 11 Anos atrás.

6.05 AutoLogin not working in 6.1 GA2

Liferay Master Postagens: 533 Data de Entrada: 04/07/10 Postagens Recentes
I have a custom AutoLogin class that worked fine in 6.05 but not in 6.1 GA2. When I step through the code with a debugger everything seems to execute correctly and my credentials array gets built and returned. However, instead of going to my requested page I'm landing on the on the sign in page. Does anyone know of any changes that were made for autologins in 6.1? I should mention that I'm passing the encrypted liferay password in my request. Here's my code:


public class SQAutoLogin implements AutoLogin {
	private static Log s_log = LogFactoryUtil.getLog(SQAutoLogin.class.getName());
	private static final String REQUESTURI = "/web/guest/pdf-reports";
	private static final String REQUESTPARM = "al";

	public String[] login(HttpServletRequest request,
			HttpServletResponse response) throws AutoLoginException {
		String credentials[] = null;

		try {
			String requestURI = request.getRequestURI();
			if (!requestURI.equals(REQUESTURI)) {
				return null;
			}

			String paramValues = request.getParameter(REQUESTPARM);
			if (paramValues == null) {
				throw new Exception("Autologin request parameters are null.");
			}

			String s[] = paramValues.split(";");
			Long userId = Long.valueOf(s[0]);
			String password = s[1];
			
			boolean success = UserLocalServiceUtil.authenticateForJAAS(userId, password);
			if(success) {
				credentials = new String[3];
				credentials[0] = String.valueOf(userId);
				credentials[1] = password;
				credentials[2] = Boolean.FALSE.toString();
			}
			else {
				throw new Exception("Invalid credentials provided for user id : " + userId);
			}	
			
		} catch (Exception e) {
			s_log.error(e.getMessage());
		}
		
		return credentials;
	}
}
thumbnail
William Gosse, modificado 11 Anos atrás.

SOLVED 6.05 AutoLogin not working in 6.1 GA2

Liferay Master Postagens: 533 Data de Entrada: 04/07/10 Postagens Recentes
I finally figured out what was breaking my autologin in 6.1.1. In the com.liferay.portal.servlet.filters.autologin.AutoLoginFilter the following code had been added to the to the getLoginRemoteUser method:

			else if (PropsValues.LIVE_USERS_ENABLED) {
					UserTracker userTracker =
						UserTrackerLocalServiceUtil.fetchUserTracker(userId);

					if ((userTracker == null) &&
						(session.getAttribute(WebKeys.USER) == null)) {

						session.invalidate();

						return null;
					}
				}


I do have live users enabled so this new code inconveniently invalidated my user session. Commenting out this code and redeploying this class as part of my extension allowed my autologin to now work. I'm not sure why live users enabled is now being check in this method but this will probably break any autologin if live users are enabled. This was the only thing that seem to be different between the 6.0 version and the 6.1 version of the getLoginRemoteUser method in the com.liferay.portal.servlet.filters.autologin.AutoLoginFilter.

One other thing I noticed is that this code passes the userId to the UserTrackerLocalServiceUtil.fetchUserTracker method. This doesn't seem to be correct because the javadocs says that the argument should be the userTrackerId, which is not the same as the userId. I think that passing the userId will always cause the method to return null. This new code just doesn't make any sense to me.
thumbnail
Adrián Rodrigo, modificado 11 Anos atrás.

RE: SOLVED 6.05 AutoLogin not working in 6.1 GA2

New Member Postagens: 16 Data de Entrada: 03/02/09 Postagens Recentes
Thanks for posting the issue, we had the same problem and we couldn't explain what was going on... We have Liferay 6.1.20 GA2 EE.
For now, we solved the problem disabling live users feature in portal-ext.properties.

Liferay's team should test better the new features or the modifications in the code that could affect other features, in this case, autologin. Clients could now be upset because an EE is supposed to have a quality control and exhaustive tests that CE does not have at that level.

So, ¿could you add this issue to JIRA (http://issues.liferay.com) with the research you did about it for Liferay's team could release a fix for this issue?

Thanks for the research and the post again!

We'll wait for the fix.
thumbnail
William Gosse, modificado 11 Anos atrás.

RE: SOLVED 6.05 AutoLogin not working in 6.1 GA2

Liferay Master Postagens: 533 Data de Entrada: 04/07/10 Postagens Recentes
Thanks for your reply. It's nice to know that others are reading my posts and find them useful. I'll get the issue into jira.
thumbnail
William Gosse, modificado 11 Anos atrás.

RE: SOLVED 6.05 AutoLogin not working in 6.1 GA2

Liferay Master Postagens: 533 Data de Entrada: 04/07/10 Postagens Recentes
Here's the jira issue I created fro this problem: http://issues.liferay.com/browse/LPS-29871
thumbnail
Shinn Lok, modificado 11 Anos atrás.

RE: SOLVED 6.05 AutoLogin not working in 6.1 GA2

Junior Member Postagens: 89 Data de Entrada: 14/01/11 Postagens Recentes
The issue was already addressed in this ticket:

http://issues.liferay.com/browse/LPS-29218

Thanks!
thumbnail
William Gosse, modificado 11 Anos atrás.

RE: SOLVED 6.05 AutoLogin not working in 6.1 GA2

Liferay Master Postagens: 533 Data de Entrada: 04/07/10 Postagens Recentes
Actually people are already working on the ticket I submitted, so it would seem the the ticket you referred to didn't fully address the issue.
thumbnail
Shinn Lok, modificado 11 Anos atrás.

RE: SOLVED 6.05 AutoLogin not working in 6.1 GA2

Junior Member Postagens: 89 Data de Entrada: 14/01/11 Postagens Recentes
The recent activity on the ticket is only for housekeeping. No code changes are going to be done.
thumbnail
Gordon Augat, modificado 10 Anos atrás.

RE: SOLVED 6.05 AutoLogin not working in 6.1 GA2

Regular Member Postagens: 107 Data de Entrada: 16/08/06 Postagens Recentes
Thanks! Just what I needed!