You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by "Øystein Grimstad (JIRA)" <ji...@apache.org> on 2012/11/07 15:15:12 UTC

[jira] [Created] (HTTPCLIENT-1258) NTLM authentication fails for local accounts

Øystein Grimstad created HTTPCLIENT-1258:
--------------------------------------------

             Summary: NTLM authentication fails for local accounts
                 Key: HTTPCLIENT-1258
                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1258
             Project: HttpComponents HttpClient
          Issue Type: Bug
          Components: HttpAuth
    Affects Versions: 4.2.1
            Reporter: Øystein Grimstad


Authenticating to a windows PC using a local account (administrator) fails. In this case, the domain property should be NULL.

Setting domain=null fails with a nullpointerexception

Setting domain="" fails with a wrong username/password

JCIFS does not have this issue and can be used as a workaround

--
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

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[jira] [Commented] (HTTPCLIENT-1258) NTLM authentication fails for local accounts

Posted by "Øystein Grimstad (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HTTPCLIENT-1258?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13493047#comment-13493047 ] 

Øystein Grimstad commented on HTTPCLIENT-1258:
----------------------------------------------

I´m using http client with cxf

List<String> authpref = new ArrayList<String>();
authpref.add(AuthPolicy.NTLM);
AsyncHTTPConduit conduit = (AsyncHTTPConduit) http;
DefaultHttpAsyncClient defaultHttpAsyncClient;
try {
    defaultHttpAsyncClient = conduit.getHttpAsyncClient();
} catch (IOException exception) {
    throw new RuntimeException(exception);
}

defaultHttpAsyncClient.getAuthSchemes().register(AuthPolicy.NTLM, new NTLMSchemeFactory());
defaultHttpAsyncClient.getParams().setParameter(AuthPNames.TARGET_AUTH_PREF, authpref);
defaultHttpAsyncClient.getCredentialsProvider().setCredentials(AuthScope.ANY, new NTCredentials("administrator", "secret", "", null));

conduit.getClient().setAllowChunking(false);
conduit.getClient().setAutoRedirect(true);

When using domain="", there is no stacktrace. Authentication simply just fails.

When using domain=null, i get the following stacktrace 
javax.xml.ws.soap.SOAPFaultException: NullPointerException invoking ...: null
	at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:156)
	at $Proxy41.getWhatever(Unknown Source)
	at com.ladida.ntlmsoap.NtlmWithCxfTest.testWhatever(NtlmWithCxfTest.java:126)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42)
	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
	at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:30)
	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
	at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:30)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:49)
	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: java.lang.NullPointerException: NullPointerException invoking ...: null
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
	at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.mapException(HTTPConduit.java:1337)
	at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1326)
	at org.apache.cxf.transport.http.asyncclient.AsyncHTTPConduit$AsyncWrappedOutputStream.close(AsyncHTTPConduit.java:361)
	at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:56)
	at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:623)
	at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62)
	at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:271)
	at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:531)
	at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:464)
	at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:367)
	at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:320)
	at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:89)
	at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:134)
	... 29 more
Caused by: java.lang.NullPointerException
	at org.apache.http.impl.auth.NTLMEngineImpl.stripDotSuffix(NTLMEngineImpl.java:175)
	at org.apache.http.impl.auth.NTLMEngineImpl.convertDomain(NTLMEngineImpl.java:188)
	at org.apache.http.impl.auth.NTLMEngineImpl.access$500(NTLMEngineImpl.java:45)
	at org.apache.http.impl.auth.NTLMEngineImpl$Type1Message.<init>(NTLMEngineImpl.java:766)
	at org.apache.http.impl.auth.NTLMEngineImpl.getType1Message(NTLMEngineImpl.java:128)
	at org.apache.http.impl.auth.NTLMEngineImpl.generateType1Msg(NTLMEngineImpl.java:1298)
	at org.apache.http.impl.auth.NTLMScheme.authenticate(NTLMScheme.java:125)
	at org.apache.http.impl.auth.AuthSchemeBase.authenticate(AuthSchemeBase.java:135)
	at org.apache.http.client.protocol.RequestAuthenticationBase.authenticate(RequestAuthenticationBase.java:125)
	at org.apache.http.client.protocol.RequestAuthenticationBase.process(RequestAuthenticationBase.java:83)
	at org.apache.http.client.protocol.RequestTargetAuthentication.process(RequestTargetAuthentication.java:80)
	at org.apache.http.protocol.ImmutableHttpProcessor.process(ImmutableHttpProcessor.java:109)
	at org.apache.http.nio.protocol.HttpAsyncRequestExecutor.requestReady(HttpAsyncRequestExecutor.java:151)
	at org.apache.http.impl.nio.DefaultNHttpClientConnection.produceOutput(DefaultNHttpClientConnection.java:238)
	at org.apache.http.impl.nio.DefaultHttpClientIODispatch.onOutputReady(DefaultHttpClientIODispatch.java:130)
	at org.apache.http.impl.nio.DefaultHttpClientIODispatch.onOutputReady(DefaultHttpClientIODispatch.java:50)
	at org.apache.http.impl.nio.reactor.AbstractIODispatch.outputReady(AbstractIODispatch.java:141)
	at org.apache.http.impl.nio.reactor.BaseIOReactor.writable(BaseIOReactor.java:181)
	at org.apache.http.impl.nio.reactor.AbstractIOReactor.processEvent(AbstractIOReactor.java:346)
	at org.apache.http.impl.nio.reactor.AbstractIOReactor.processEvents(AbstractIOReactor.java:320)
	at org.apache.http.impl.nio.reactor.AbstractIOReactor.execute(AbstractIOReactor.java:280)
	at org.apache.http.impl.nio.reactor.BaseIOReactor.execute(BaseIOReactor.java:106)
	at org.apache.http.impl.nio.reactor.AbstractMultiworkerIOReactor$Worker.run(AbstractMultiworkerIOReactor.java:604)
	at java.lang.Thread.run(Thread.java:680)
                
> NTLM authentication fails for local accounts
> --------------------------------------------
>
>                 Key: HTTPCLIENT-1258
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1258
>             Project: HttpComponents HttpClient
>          Issue Type: Bug
>          Components: HttpAuth
>    Affects Versions: 4.2.1
>            Reporter: Øystein Grimstad
>
> Authenticating to a windows PC using a local account (administrator) fails. In this case, the domain property should be NULL.
> Setting domain=null fails with a nullpointerexception
> Setting domain="" fails with a wrong username/password
> JCIFS does not have this issue and can be used as a workaround

--
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

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[jira] [Commented] (HTTPCLIENT-1258) NTLM authentication fails for local accounts

Posted by "Gary Gregory (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HTTPCLIENT-1258?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13492382#comment-13492382 ] 

Gary Gregory commented on HTTPCLIENT-1258:
------------------------------------------

Can you post your stack trace please?

A code snippet too?
                
> NTLM authentication fails for local accounts
> --------------------------------------------
>
>                 Key: HTTPCLIENT-1258
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1258
>             Project: HttpComponents HttpClient
>          Issue Type: Bug
>          Components: HttpAuth
>    Affects Versions: 4.2.1
>            Reporter: Øystein Grimstad
>
> Authenticating to a windows PC using a local account (administrator) fails. In this case, the domain property should be NULL.
> Setting domain=null fails with a nullpointerexception
> Setting domain="" fails with a wrong username/password
> JCIFS does not have this issue and can be used as a workaround

--
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

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[jira] [Commented] (HTTPCLIENT-1258) NTLM authentication fails for local accounts

Posted by "Oleg Kalnichevski (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HTTPCLIENT-1258?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13493093#comment-13493093 ] 

Oleg Kalnichevski commented on HTTPCLIENT-1258:
-----------------------------------------------

Øystein

I committed the following change set to the 4.2.x branch that should address the immediate problem and fix the NPE. 

http://svn.apache.org/viewvc?view=revision&revision=1406998

However, it looks like the default NTLMEngine implementation expects both the hostname and the domain to be non-null. When using a local account try using the name of the host as both hostname and domain and let me know if that fixes the problem.

Oleg

PS: I wish we could simply bundle JCIFS with HttpClient and throw away our own implementation.
                
> NTLM authentication fails for local accounts
> --------------------------------------------
>
>                 Key: HTTPCLIENT-1258
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1258
>             Project: HttpComponents HttpClient
>          Issue Type: Bug
>          Components: HttpAuth
>    Affects Versions: 4.2.1
>            Reporter: Øystein Grimstad
>
> Authenticating to a windows PC using a local account (administrator) fails. In this case, the domain property should be NULL.
> Setting domain=null fails with a nullpointerexception
> Setting domain="" fails with a wrong username/password
> JCIFS does not have this issue and can be used as a workaround

--
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

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[jira] [Resolved] (HTTPCLIENT-1258) NTLM authentication fails for local accounts

Posted by "Oleg Kalnichevski (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HTTPCLIENT-1258?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Oleg Kalnichevski resolved HTTPCLIENT-1258.
-------------------------------------------

       Resolution: Fixed
    Fix Version/s: 4.2.3
    
> NTLM authentication fails for local accounts
> --------------------------------------------
>
>                 Key: HTTPCLIENT-1258
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1258
>             Project: HttpComponents HttpClient
>          Issue Type: Bug
>          Components: HttpAuth
>    Affects Versions: 4.2.1
>            Reporter: Øystein Grimstad
>             Fix For: 4.2.3
>
>
> Authenticating to a windows PC using a local account (administrator) fails. In this case, the domain property should be NULL.
> Setting domain=null fails with a nullpointerexception
> Setting domain="" fails with a wrong username/password
> JCIFS does not have this issue and can be used as a workaround

--
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

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org