Question

I have a jax-ws/metro 2.2 web service with username authentification running on glassfish 3.1.2. How can I get the name of acutally logged in users?

Was it helpful?

Solution

You can obtain the name the user logged in with via WebServiceContext's getUserPrincipal().getName()

See this for potential gotchas.

As for obtaining the names of any other user logged in, you'll have to work something out yourself in your web-apps with some common store (application level? db?) - that would be a violation of security policy that Java EE's not going to support out of box.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top