Search code examples
web-servicesmonoxamarin.iosntlmntlmv2

MonoTouch support for accessing Mono.Security.Protocol.Ntlm.NtlmFlags


We use NTLM auth to access an ASP.net web services from our MonoTouch app and everything works fine.

One of our customers uses the same app and the NTLM auth fails from our app but works from the iPad's Safari browser.

Looking at the packet flow from the customer, the server does not return NTLMSSP_CHALLENGE, when our app sends NTLMSSP_NEGOTIATE message.

Looking the differences between our app's NTLMSSP_NEGOTIATE message and iPad's Safari same message Our MT app sets the NTLM flags to 0xb203 and Safari sets this to 0x88207. The NegotiateNtlm2Key is set to 0 in our app and 1 in Safari Our app also sends the calling workstation domain and name fields whereas Safari send both as null.

The client's server is Windows Server 2003 and they also use Kerberos as their main authentication scheme and fall back on NTLM.

Would setting the NegotiateNtlm2Key flags in Mono.Security.Protocol.Ntlm.NtlmFlags help?


Solution

  • NTLMv2 Session and NTLMv2 Authentication has now been implemented in Mono (mono/master commit 45745e5).

    See this article for a description of the different NTLM versions.

    By default, Mono now uses NTLMv2 Session Authentication whenever the server supports it and falls back to LM & NTLM otherwise.

    The default behavior can be configured by using the new Mono.Security.Protocol.Ntlm.Type3Message.DefaultAuthLevel property in Mono.Security.dll (see Type3Message.cs and NtlmAuthLevel.cs in mcs/class/Mono.Security/Mono.Security.Protocol.Ntlm).

    This is similar to the Lan Manager Authentication Level in Windows.

    Update 01/26/13

    There has been an issue with Microsoft Server 2008 RC2 not accepting the domain name that it sent back in the Type 2 Message's Target Name (or Domain Name from the Target Info block).

    Therefore, we are now using the domain name from the NetworkCredential to allow the user to specify the desired domain. This is also the domain name that's initially being sent to the server in the Type 1 Message.