Fórumok

Auto login

venka reddy, módosítva 9 év-val korábban

Auto login

Regular Member Bejegyzések: 231 Csatlakozás dátuma: 2011.03.23. Legújabb bejegyzések
Hi,

Iam trying to do AutoLogin in liferay but struck in the middle, Here is the steps i follow

1.Created a hook and in portal.properties i have added an entry as
auto.login.hooks=com.sample.auto.TestAutoLogin

2. Created class as TestAutoLogin class implemented with AutoLogin as

public class TestAutoLogin implements AutoLogin {

@Override
public String[] login(HttpServletRequest request,
HttpServletResponse response) throws AutoLoginException {

long userId = ParamUtil.getLong(request, "autoLoginUserId");
if(Validator.isNull(userId)) {
return null;
}
User user = null;
try {
user = UserLocalServiceUtil.getUser(userId);
return new String[] {
String.valueOf(user.getUserId()),
user.getPassword(),
String.valueOf(user.isPasswordEncrypted())
};
} catch (PortalException e) {
e.printStackTrace();
} catch (SystemException e) {
e.printStackTrace();
}
return null;
}
}

3. Also added the property in Portal-ext.properties as

#
# Enter a list of comma delimited paths that do not require authentication.
#
auth.public.paths=\
/portal/urlInvoker

Finally Deployed the hook and restarted the server.

If i hit the url as "http://localhost:8080/web/guest/home?autoLoginUserId= 10198" it works means the user is auto logged.

But when i trying the url as http://localhost:8080/c/portal/urlInvoker?autoLoginUserId=10198 , its not working means the users is not auto logged. Please suggest?
thumbnail
Nagendra Kumar Busam, módosítva 9 év-val korábban

R: Auto login

Liferay Master Bejegyzések: 678 Csatlakozás dátuma: 2009.07.07. Legújabb bejegyzések
You need to map your public path to a proper struts action as this is custom path

Sent from my iPhone with Liferay.com Forums