You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Shaun Elliott (JIRA)" <ji...@apache.org> on 2012/10/02 02:48:07 UTC

[jira] [Comment Edited] (CXF-4525) expose http client, allow for NTLM authentication

    [ 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:47 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}
		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( crmServiceSoap );
		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