Hi All,
I want to retrieve the authenticated user attributes from Active directory. I am doing authentication through the j_security_check feature provided in tomcat. The Realm I am using is JNDIRealm. After doing successful authentication on login page the user request forwarded to my servlet(for example "LoginServlet"). In this servlet I required to fetch the other authenticated user attributes(example first name, last name, telephone, email address). Now the challenge comes here that I am restricted to fetch only limited information about the authenticated user; roles etc. But I am unable to fetch the first name, last name also of the authenticated user(by specifying the username as input) from active directory.
I am taking the help of GenericPrinciple.java class provided by the apache. Part of the code written in my LoginServlet.
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
Principal userPrincipal = request.getUserPrincipal();
String roles[] = (String[])(userPrincipal.getClass().getMethod("getRoles", null).invoke(userPrincipal, null));
String userName = request.getUserPrincipal().getName();
GenericPrincipal genericPrincipal = (GenericPrincipal)userPrincipal;
// WHAT ARE THE NEXT STEPS TO FETCH OTHER ATTRIBUTES.
}
If anybody knows please help me out.
Thanks
Arpit
I want to retrieve the authenticated user attributes from Active directory. I am doing authentication through the j_security_check feature provided in tomcat. The Realm I am using is JNDIRealm. After doing successful authentication on login page the user request forwarded to my servlet(for example "LoginServlet"). In this servlet I required to fetch the other authenticated user attributes(example first name, last name, telephone, email address). Now the challenge comes here that I am restricted to fetch only limited information about the authenticated user; roles etc. But I am unable to fetch the first name, last name also of the authenticated user(by specifying the username as input) from active directory.
I am taking the help of GenericPrinciple.java class provided by the apache. Part of the code written in my LoginServlet.
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
Principal userPrincipal = request.getUserPrincipal();
String roles[] = (String[])(userPrincipal.getClass().getMethod("getRoles", null).invoke(userPrincipal, null));
String userName = request.getUserPrincipal().getName();
GenericPrincipal genericPrincipal = (GenericPrincipal)userPrincipal;
// WHAT ARE THE NEXT STEPS TO FETCH OTHER ATTRIBUTES.
}
If anybody knows please help me out.
Thanks
Arpit