Reputation: 1487
How can I get authenticated user info from JAX-WS Web Service?
Thanks
Upvotes: 2
Views: 3404
Reputation: 1487
I didn't know how to mark the question as answered as @home answered the question as a comment.
Anyhow, following is the answer
@WebService()
public class MyWebService{
@Resource
private WebServiceContext wsContext;
@WebMethod
public void echoHello(String msg) {
System.out.println("Username = " + wsContext.getUserPrincipal().getName());
}
}
Upvotes: 6