Unless you actually need the Principal object, this is a little cleaner and probably keeps you from having to worry about what your container is.
Customer surveys are for companies who didn't pay proper attention to begin with.
Joined: Oct 10, 2006
Thank you very much for replying. I probably should have mentioned before that I tried getRemoteUser as well.
FacesContext facesContext = FacesContext.getCurrentInstance(); String name = facesContext.getExternalContext().getRemoteUser();
This also returned a null value. Am I missing something. Do I need anything else besides these two lines? I am just trying to retrieve the Windows authenticated user. Currently testing this on Windows XP. Thanks for any help.
OK, there's your problem. Windows authentication (LAN authentication) and web browser authentication are 2 different things, unless you specifically set up the Windows box to turn on the IE single-signon option (amazing isn't it, a case where Windows was actually secure by default!). In which case, you have enabled a protocol that causes your windows credentials to be passed as piggyback data to the web server.
You can really only use this feature on a LAN, since not all of us out here are logged into your Windows domain, or even running under Windows.
The getRemoteUser and getUserPrincipal methods get their data from the webserver's J2EE authentication and authorization service (Tomcat calls it a security Realm). Only if you have setup a realm that ties into the LAN authentication and authorization services will it be able to supply Windows user identity info.