Search code examples
javaliferayportal

Get user credentials of the user who logs into liferay portal


I want to get the userid and password of the user who logs into the liferay portlet.I am able to get the userid who has logged into the portal by using

String userName = (userInfo != null) ? (String)userInfo.get("**user.name.given**")

Now I need to get the password too. How can I do that?

I am doing this beacause I need to login to two iframes (different websites), with the same userid and password(which was entered to log into the portal).


Solution

  • Its solved !!!

    We can get username and password as follows,

    String username = themeDisplay.getUser().getScreenName();
    String password = (String)request.getSession().getAttribute(WebKeys.USER_PASSWORD);
    

    and in portal-ext.properties, set

    session.store.password=true
    session.shared.attributes.excludes=