How to get a user role set from a Tomcat servlet?

Discussions

Web tier: servlets, JSP, Web frameworks: How to get a user role set from a Tomcat servlet?

  1. Hi,

    I´m new to Tomcat. I want to make a servlet to show a dynamic menú of options based on the roles of the authenticated user. To accomplish that, I have a table with 'option' and 'role' columns. I want to know how to programatically obtain the set of roles of the authenticated user, independent from the type of the security realm used.

    I will appreciate any help.
  2. 1. use the HttpServletRequest to retrieve the user name
    req.getRemoteUser();

    2. use the user name retrieve the user role from the realm (JNDI, JDBC etc).

    HTH.

    chiew
  3. Yes, I know how to get the user login name. Please tell me how to access the realm (in order to retrieve the user role) independently from the type of realm used.