tags:

views:

41

answers:

1

I have a webservice with basic HTTP authentication on a JBoss server. Is there a way to retrieve the authentication credentials (username, pw) supplied by the caller from within the webservice?

+1  A: 

Have you checked the HTTP headers? There should be an "Authorization" header that indicates that Basic Authentication was used. It should also include a Base64-encoded String representing the username/password.

Shadowman
How would I check the HTTP headers from the web service on the server side? Thanks for the suggestion!
Ray
Got it working:https://jax-ws.dev.java.net/articles/MessageContext.htmlhttp://community.jboss.org/message/338026#338026For web services, you'll need to use MessageContext and the @Resource annotation to have access to additional metadata parameters not included in SOAP message calls. The links above make it pretty straightforward. The username and password are stored as a colon-delimited value in 64bit encoding in the "authorization" header, for BASIC authentication only
Ray