问题
I want to use facebook to login into Websphere Portal. I use facebook ID to retrieve LDAP uid, but cannot get password. What API can I use to login to portal without password?
Here is my code:
Context ctx = new InitialContext();
PortletServiceHome pumaHomeService = (PortletServiceHome) ctx.lookup("portletservice/com.ibm.portal.um.portletservice.PumaHome");
PumaHome pumaHome = pumaHomeService.getPumaService().getPortletService(PumaHome.class);
PumaLocator pumaLocator = pumaHome.getLocator(request);
List<User> users = locator.findUsersByAttribute("uid", "testUser");
User pumaUser = users.get(0);
// How to login this pumaUser without password?
回答1:
What you describe here is the establishment of a trust relationship in WebSphere. You can't do this via the PUMA SPI but the process is fairly straightforward.
The high level steps are:
- Implement a custom Trust Association Interceptor class
- Register it with WebSphere Application Server
- In your TAI class, return the uid from your original logic.
There are a few tutorials online. Some are simple, as it is an easy process if your requirement is to log in via username / uid. Bear in mind - TAIs are very powerful, so be sure to understand and be certain when your TAI chooses to perform its logic.
Hope this helps,
-Scott H
来源:https://stackoverflow.com/questions/14528457/login-user-into-websphere-portal-without-password-using-puma