-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Ben,

Ben Tomlinson wrote:
> How do I retrieve information about the user that
> is actually logged in?  Mainly I want the user role or the user name
> but I can't seem to get it from the session.

As Alan points out, you can get the UserPrincipal (or just the name)
from the request. Unfortunately, you cannot get the list of roles for
the user from that object. The best you can do using the servlet API is
to ask the request if the currently-logged-in user is in a specific role
(you have to know what role you want to ask for up front).

I've always maintained a separate "user" object in the session that
contains information like this, so you can consult it to, say, determine
the complete list of roles a particular user has without having to check
each one individually.

Hope that helps,
- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAklvUHMACgkQ9CaO5/Lv0PDtcgCffRSeKwQOLN3dQKPaJ6lN2arX
EaUAnjg1T98W5VAv8u4EVvHJoB5176Qz
=OUWm
-----END PGP SIGNATURE-----

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

Reply via email to