Android NTLM Authentication

I use the JCIFS library found here to use NTLM authentication in my Android application. The application worked fine when it just went to the site and parsed the xml, but now that I have added NTLM auth, it does not seem to work. Can anyone tell from this code snippet if the problem is between httpclient and input stream?

DefaultHttpClient client = new DefaultHttpClient();
client.getAuthSchemes().register("ntlm", new NTLMSchemeFactory());
client.getCredentialsProvider().setCredentials(new AuthScope("http://www.musowls.org",80),
new NTCredentials(username, password, null, "musschool"));  
HttpGet request = new HttpGet("http://www.musowls.org/assignments/assignmentsbystudentxml.aspx");
 HttpResponse resp = client.execute(request);
 HttpEntity entity = resp.getEntity();
 InputStream inputStream = entity.getContent();
+3
source share
3 answers

Try it under code, this may help you.

DefaultHttpClient httpclient = new DefaultHttpClient();
httpclient.getAuthSchemes().register("ntlm", new NTLMSchemeFactory());

NTCredentials creds = new NTCredentials("user_name", "password", "", "http://www.musowls.org/");

httpclient.getCredentialsProvider().setCredentials(AuthScope.ANY, creds);
HttpConnectionParams.setConnectionTimeout(httpclient.getParams(), 5000);

HttpPost httppost = new HttpPost("http://www.musowls.org/assignments/assignmentsbystudentxml.aspx");
httppost.getParams().setBooleanParameter(CoreProtocolPNames.USE_EXPECT_CONTINUE, false);
HttpResponse response = httpclient.execute(httppost); // ERROR HAPPENS HERE

responseXML = EntityUtils.toString(response.getEntity());
Log.d("Responce", responseXML);
0
source

Stuck in this problem for too long.

Check the response in this thread to use OkHttp3 for NTLM Authenticated Calls:

fooobar.com/questions/768223 / ...

0
source

All Articles