Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to perform an NTLM challenge on the iPhone

Tags:

iphone

ntlm

I'm trying to access some web services in an iPhone application.

If I GET to the .asmx page, I authenticate and get the WSDL as expected.

However, if I POST to the .asmx page, setting the SOAPAction, Content-Type, Content-Length, and HTTPBody, I just keep getting didReceiveAuthenticationChallenge messages.

Additionally, I'm trying to POST to IIS using Integrated Windows Authentication (IWA), which means I'm trying to negotiate an NTLM challenge.

like image 763
Benjamin Autin Avatar asked Mar 10 '09 04:03

Benjamin Autin


People also ask

How do I force NTLM authentication?

Click down to “Local Computer Policy -> Computer Configuration -> Windows Settings -> Security Settings -> Local Policies -> Security Options. Find the policy “Network Security: LAN Manager authentication level”. Right click on this policy and choose “Properties”. Choose “Send NTLMv2 response only/refuse LM & NTLM”.

What is the default authentication method in IOS?

The most common app authentication method is the traditional password request. Without entering the correct password, access to an app may not be granted.

Is NTLM authentication still used?

NTLM authentication is still supported and must be used for Windows authentication with systems configured as a member of a workgroup. NTLM authentication is also used for local logon authentication on non-domain controllers.

What is Urlauthenticationchallenge?

A challenge from a server requiring authentication from the client.


2 Answers

I unfortunately found my answer. NSURLConnection cannot do NTLM authentication. Here's a post about how to do NTLM authentication using the CFNetwork stack.

HTTP Post via the CFNetwork stack

Found something even better than doing all of that tediousness: Someone who has already done it!
ASIHTTPRequest

Update: There is a workaround for iOS 4 that allows for NTLM authentication again

like image 110
Benjamin Autin Avatar answered Nov 04 '22 02:11

Benjamin Autin


Sounds to me like your web-service has different read (get) and write (post) permissions. I dont think this is an issue with the iPhone or NSURLConnection at all.

like image 33
Lounges Avatar answered Nov 04 '22 04:11

Lounges