Topic
No replies
RekhaKumari
RekhaKumari
1 Post
ACCEPTED ANSWER

Pinned topic user switch to admin on ldap search using puma locator.

‏2012-07-06T10:31:53Z |
When portal perform a search using puma locator,the user id gets switched to wpsbind, which ignores ldap policy.I want to perofrm the search by logged-in user not thru admin, so that I can trap the ldap exception and show change/reset password popup screen for logged-in user. However,when I perform search using ldp command it properly throws exception because there is restricted policy for first time login.I have put lot of effort on this,but couldn't get through.Please help.Following is code snippet which I using in processAction method.Thanks.
if(request.getParameter(FORM_ID)!= null){
System.out.println("CustomLoginPortlet.java processAction normal login pocessing...");
LoginService loginService = (LoginService) loginHome.getLoginService(request, response);
String userId = request.getParameter(FORM_ID);
String password = request.getParameter(FORM_PASSWORD);
Map<String, Boolean> contextMap = new HashMap<String, Boolean>();
contextMap.put(LoginService.DO_RESUME_SESSION_KEY, new Boolean(false));

try {
System.out.println("userId############################################################...."+userId);

loginService.login(userId, password.toCharArray(), contextMap, null);

PumaHome pumaHome = null;
Context ctx = new InitialContext();
Name name = new CompositeName(PumaHome.JNDI_NAME);
if (pumaHome == null) {
pumaHome = (PumaHome) ctx.lookup(name);
}
System.out.println("============================================================");
PumaLocator pl = pumaHome.getLocator();
List userList = pl.findUsersByAttribute("uid", userId);
System.out.println("============================================================");
System.out.println("############################################################");
} catch (Exception ex) {
System.out.println("CustomLoginPortlet.java Exception Occured in normal login process...");
ex.printStackTrace();
}
}