axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mark A. Richman" <>
Subject Re: HTTP Authentication in Axis
Date Tue, 04 Dec 2001 15:36:26 GMT
Thanks Dug. Perhaps there is a way to handle this without mangling the
method signatures? For example, create a utility class with static methods
that return the authentication info, but invoke it from the body of the web
service method:

public Object myServiceMethod(int foo) throws Exception {
    AuthInfo auth = AuthInfoFactory.getAuthInfo(); // get from HTTP header
for this invokation
    String username = auth.getUsername();
    String password = auth.getPassword();

where AuthInfo looks something like this:

public interface AuthInfo {
  public String getUsername();
  public void setUsername(String username);
  public String getPassword();
  public void setPassword(String password);
  public String getRealm();
  public void setRealm(String realm);
  public boolean isValid() throws UnauthorizedException;

Any thoughts? This thread may be more appropriate for axis-dev...I'll
subscribe if you like.

- Mark

----- Original Message -----
From: "Doug Davis" <>
To: <>
Sent: Tuesday, December 04, 2001 10:17 AM
Subject: Re: HTTP Authentication in Axis

We have the same hack.  :-)
Instead of SOAPContext its MessageContext.
You could of course write an auth. handler that
sits in the transport chain.

"Mark A. Richman" <> on 12/04/2001 10:11:43 AM

Please respond to

To:   <>
Subject:  HTTP Authentication in Axis

Greetings all...

I plan to update the chapter samples from my book  Professional XML Web
Services with Axis-based code rather than the SOAP  2.x code. Much of my
code handles authentication & authorization via HTTP  header info (see Chap
14 on my website). What is the best way to get the  authenticated user's
username (or any other header info) from within the service  implementation
using Axis? With SOAP 2.x I had to prepend a SOAPContext variable  to the
parameter list, so the service would gain access to the headers. How has
this changed in Axis? I always saw the SOAPContext parameter as a more of a
hack  than a usable mechanism.

Mark A. Richman

View raw message