Abhishek Jain Abhishek Jain - 1 year ago 73
Java Question

How to get login credentials in liferay?

I made a hook by implementing

Now I tried to get the login credentials submitted through the default login form. The code which I tried is:-


but it could not retrieve login credential so I want to ask how to retrieve login credential.

Answer Source

You can get username and password by using following ways:

String username = themeDisplay.getUser().getScreenName();

String password = (String)request.getSession().getAttribute(WebKeys.USER_PASSWORD);

and write the below lines in portal-ext.properties:



But you need to take the precaution because when you use session.store.password=true then passwords will be stored n clear text and the same will be appear in dumps.

I hope this resolves your issue.