Am 04.12.2016 um 08:04 schrieb Taylor, Larry:
Hello,

For  Users that have authenticated  from the Web Login page through Tomcat 
Realm LDAP configuration is it possible to get the authenticated user's 
ou=Organizational Unit or Department name?   and also what their role names 
are?   I need this information to pass to a servlet or jsp page.

I saw documentation about the java.security.Principal class but could not find 
any documentation or examples on how to get this type of information after 
users are authenticated.

I am able to get the username with  ${pageContext.request.userPrincipal.name} & 
 request.getRemoteUser(); but nothing about how to get the user's member 
affiliations and roles.
The standard way to get the roles is to iterate over your expected roles and ask for request.isUserInRole(role). The servlet spec has no API to get directly a list of roles.

If you are willing to bind yourself to the implementation of JNDIRealm you could get the list of roles. But I don't recommend it, as that implementation is not guaranteed to stay stable.

Do you really need to get the list, or is isUserInRole enough?

Regards,
 Felix

Any information or pointers on this is appreciated.


________________________________
Larry Taylor




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to