cxf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Shaun Elliott (JIRA)" <j...@apache.org>
Subject [jira] [Comment Edited] (CXF-4525) expose http client, allow for NTLM authentication
Date Tue, 02 Oct 2012 00:50:07 GMT

    [ https://issues.apache.org/jira/browse/CXF-4525?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13467363#comment-13467363
] 

Shaun Elliott edited comment on CXF-4525 at 10/2/12 11:49 AM:
--------------------------------------------------------------

I've got it to work, thanks a bunch!

A couple of things to note:

1) Before I got it to work, I still had adjustments to the client as a relic of the old basic
auth code:
{code}
		HTTPClientPolicy httpClientPolicy = new HTTPClientPolicy();
		httpClientPolicy.setConnectionTimeout( 36000 );
		httpClientPolicy.setAllowChunking( false );

		http.setClient( httpClientPolicy );
{code}

But that obviously won't work. What I got to work (for documentation purposes) was based on
your unit test instead (thanks for that):

{code}
Bus bus = BusFactory.getDefaultBus();
bus.setProperty( "use.async.http.conduit", "true" );

		Client client = ClientProxy.getClient( proxy );
		HTTPConduit http = (HTTPConduit)client.getConduit();
		if ( http instanceof AsyncHTTPConduit ) {
			AsyncHTTPConduit conduit = (AsyncHTTPConduit)http;
			DefaultHttpAsyncClient defaultHttpAsyncClient;
			try {
				defaultHttpAsyncClient = conduit.getHttpAsyncClient();
			}
			catch ( IOException exception ) {
				throw new RuntimeException( exception );
			}
			defaultHttpAsyncClient.getCredentialsProvider().setCredentials( AuthScope.ANY,
				new NTCredentials( "username", "password", "", "domain" ) );

			conduit.getClient().setAllowChunking( false );
			conduit.getClient().setAutoRedirect( true );
		}
{code}

Hopefully that will help someone else on down the line or give you guys documentation for
"how to do NTLM authentication with CXF". p.s. The old link suggests using jcifs, which, I
believe does not work unless running on Windows XP\NT (very poor solution, I could not get
it to work).

2) Is CXF 2.7.0 planned to be java 1.6? I could not get it to work with 1.5.

Thanks again!

                
      was (Author: selliott):
    I've got it to work, thanks a bunch!

A couple of things to note:

1) Before I got it to work, I still had adjustments to the client as a relic of the old basic
auth code:
{code}
		HTTPClientPolicy httpClientPolicy = new HTTPClientPolicy();
		httpClientPolicy.setConnectionTimeout( 36000 );
		httpClientPolicy.setAllowChunking( false );

		http.setClient( httpClientPolicy );
{code}

But that obviously won't work. What I got to work (for documentation purposes) was based on
your unit test instead (thanks for that):

{code}
		Client client = ClientProxy.getClient( proxy );
		HTTPConduit http = (HTTPConduit)client.getConduit();
		if ( http instanceof AsyncHTTPConduit ) {
			AsyncHTTPConduit conduit = (AsyncHTTPConduit)http;
			DefaultHttpAsyncClient defaultHttpAsyncClient;
			try {
				defaultHttpAsyncClient = conduit.getHttpAsyncClient();
			}
			catch ( IOException exception ) {
				throw new RuntimeException( exception );
			}
			defaultHttpAsyncClient.getCredentialsProvider().setCredentials( AuthScope.ANY,
				new NTCredentials( "username", "password", "", "domain" ) );

			conduit.getClient().setAllowChunking( false );
			conduit.getClient().setAutoRedirect( true );
		}
{code}

Hopefully that will help someone else on down the line or give you guys documentation for
"how to do NTLM authentication with CXF". p.s. The old link suggests using jcifs, which, I
believe does not work unless running on Windows XP\NT (very poor solution, I could not get
it to work).

2) Is CXF 2.7.0 planned to be java 1.6? I could not get it to work with 1.5.

Thanks again!

                  
> expose http client, allow for NTLM authentication
> -------------------------------------------------
>
>                 Key: CXF-4525
>                 URL: https://issues.apache.org/jira/browse/CXF-4525
>             Project: CXF
>          Issue Type: Improvement
>          Components: Transports
>    Affects Versions: 2.7.0
>            Reporter: Shaun Elliott
>            Assignee: Daniel Kulp
>             Fix For: 2.7.0
>
>
> The class: CXFAsyncRequester hides the DefaultHttpAsyncClient, thus preventing interaction
from outside classes. One use case would be to leverage the embedded DefaultHttpAsyncClient
to do NTLM authentication, which is currently not possible with CXF.
> AsyncHTTPConduit will also need a getter on the factory field.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message