You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by pat <pa...@xvalheru.org> on 2007/03/20 21:57:11 UTC

http authentication with Axis2

Hello,

I'm fighting with http authentication in Axis2 in the generated code with
XMLBeans. I've set up Tomcat's realms and updated the Axis2 web.xml by adding
this:
<security-constraint>
 <display-name>admin-constraint</display-name>
 <auth-constraint>
  <description/>
  <role-name>axis2admin</role-name>
 </auth-constraint>
</security-constraint>
<security-role>
 <description>admin-role</description>
 <role-name>axis2admin</role-name>
</security-role>

Then I followed the Axis2 documentation:
Options options = new Options();
HttpTransportProperties.Authenticator auth = ...;
auth.setUsername("username");
auth.setPassword("password");
options.setProperty(HTTPConstants.BASIC_AUTHENTICATE,auth);

... and I'm cofused :-(

The "BASIC_AUTHENTICATE" doesn't exist in the class, so I've used the
"AUTHENTICATE" as:
options.setProperty(HTTPConstants.AUTHENTICATE,auth);

I want to use generated stub as follows:
TestStub stub = new TestStub(ConfigurationContext, String);

I expect the connection has to be configured with ConfigurationContext
instance, but which properties and how to be set to it?

Can comeone sent me a example which describes the ConfigurationContext
instance setup?

Thanks a lot.

     Pat

P.S. Yes I've googled a lot but without luck :-(

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Re: http authentication with Axis2

Posted by Jarek Kucypera <jk...@mikrozet.wroc.pl>.
pat wrote:

In case of axis2 1.1.1 this should help:
auth.setPreemptiveAuthentication(true);

The lack of documentation is disappointing , isn't it ...?

J.K.


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


RE: http authentication with Axis2

Posted by Kin Onn Low <ko...@ap.savi.com>.
Here's the code I'm using :

        ArrayList<String> authSchemes = new ArrayList<String>();
        authSchemes.add(HttpTransportProperties.Authenticator.BASIC);

        HttpTransportProperties.Authenticator auth = new
        HttpTransportProperties.Authenticator();

        auth.setPreemptiveAuthentication(true);
        auth.setAuthSchemes(authSchemes);
        auth.setUsername(username); 
        auth.setPassword(password);
        
        client.getOptions().setProperty(HTTPConstants.AUTHENTICATE,
auth);   

where client is the OperationClient instance.  Hope this helps.



-----Original Message-----
From: pat [mailto:pat@xvalheru.org] 
Sent: Wednesday, March 21, 2007 4:57 AM
To: axis-user
Subject: http authentication with Axis2

Hello,

I'm fighting with http authentication in Axis2 in the generated code
with
XMLBeans. I've set up Tomcat's realms and updated the Axis2 web.xml by
adding
this:
<security-constraint>
 <display-name>admin-constraint</display-name>
 <auth-constraint>
  <description/>
  <role-name>axis2admin</role-name>
 </auth-constraint>
</security-constraint>
<security-role>
 <description>admin-role</description>
 <role-name>axis2admin</role-name>
</security-role>

Then I followed the Axis2 documentation:
Options options = new Options();
HttpTransportProperties.Authenticator auth = ...;
auth.setUsername("username");
auth.setPassword("password");
options.setProperty(HTTPConstants.BASIC_AUTHENTICATE,auth);

... and I'm cofused :-(

The "BASIC_AUTHENTICATE" doesn't exist in the class, so I've used the
"AUTHENTICATE" as:
options.setProperty(HTTPConstants.AUTHENTICATE,auth);

I want to use generated stub as follows:
TestStub stub = new TestStub(ConfigurationContext, String);

I expect the connection has to be configured with ConfigurationContext
instance, but which properties and how to be set to it?

Can comeone sent me a example which describes the ConfigurationContext
instance setup?

Thanks a lot.

     Pat

P.S. Yes I've googled a lot but without luck :-(

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org