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?

Était-ce utile?

La 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.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top