Print  
Gray star Gray star Gray star Gray star Gray star --Not rated--
700 Visits 2 Comments
Created
johan mare van zyl johan mare van zyl
Modified by
Peter Hurley (Novell) Peter Hurley (Novell)
Nov 14, 2007 2:39 AM
Kablink Component
  • Teaming

Hello 

I am very new to the Java 2 EE environment and portlet technology, so please excuse me if this is a stupid question.  

One of the key features of a portal is that it provides single sign-on. I am creating a portlet that has to authenticate through LDAP with eDirectory. The ICECore Teaming server is set up so that it

authenticates the user through eDirectory. That works fine. My problem is that after the user has logged on, I need to get that currently logged in user's username and password so that I

can use that credentials to log into another server for my portlet to work. My question is thus: Ho do I get the currently logged in user's username and password?

 Thank you

Kind regards

Johan 

 

Workflow
Process State Action
Discussion workflow Active
This entry is currently active
Attachments(0)
Entry History
Tags
 
Replies
Thumbnail Image
Peter Hurley (Novell) Peter Hurley (Novell)
By the time you get to the portal, your user password is no longer available. We don't store the password in the clear inside ICEcore. So, you must get the password earlier in the login process. Liferay passes the password to ICEcore during the login process. This lets ICEcore establish the ICEcore user name. There are ways to get called from Liferay at this point. I'm not the right person to give details, but I'll get someone to answer this shortly.
Thumbnail Image
Brent McConnell Brent McConnell
Modified by
Brent McConnell Brent McConnell
Nov 13, 2007 2:43 PM

Liferay uses a process to authenticate all users.  It basically calls a list of classes that extend the com.liferay.portal.struts.Action before a user authenticates and a list after authentication.  This is highly configurable using the portal.properties and portal-ext.properties file.  The following values can be changed by adding your own custom class that extends the com.liferay.portal.struts.Action class.  We actually have a class you can look at that implements this Action called com.sitescape.team.liferay.events.LoginPostAction and com.sitescape.team.liferay.events.AbstractAction.  Look for the following entries in the portal.properties file.  

login.events.pre=com.liferay.portal.events.LoginPreAction    login.events.post=com.sitescape.team.liferay.events.LoginPostAction,com.liferay.portal.events.LoginPostAction,com.liferay.portal.events.DefaultLandingPageAction

Inside the custom class you create you can use the PortalUtil class to get the information you want.

            com.liferay.portal.model.User user = PortalUtil.getUser(req);
            String password = PortalUtil.getUserPassword(req);

 I hope this helps.

Skip Footer Toolbar