You can only enable and disable the authentication methods available under the following section:
system.webServer/authentication
This is because system.webServer/authentication
is not a collection and does not support the add
and remove
config elements. Have a look in the IIS configuration schema file in:
C:\Windows\System32\inetsrv\config\schema\IIS_schema.xml
Search for system.webServer/security/authentication
and you will see that each child element of that section is explicitly defined and there is no definition for system.webServer/security/authentication
itself.
With regards to ordering, it makes no difference trying to change the authentication method order. For example in the following order (Basic is before Windows Authenticaton):
<system.webServer>
<security>
<authentication>
<basicAuthentication enabled="true" />
<windowsAuthentication enabled="true" />
</authentication>
</security>
</system.webServer>
and when I swap the order:
<system.webServer>
<security>
<authentication>
<windowsAuthentication enabled="true" />
<basicAuthentication enabled="true" />
</authentication>
</security>
</system.webServer>
...will always cause IIS to send the following headers to the browser in the 401 challenge (captured using Fiddler):
HTTP/1.1 401 Unauthorized
Server: Microsoft-IIS/7.5
WWW-Authenticate: Negotiate
WWW-Authenticate: NTLM
WWW-Authenticate: Basic realm="172.16.3.87"
In the above, IIS is indicating to the browser that it supports Kerberos, NTLM or Basic authentication methods. Out of the box these authentication methods are always in this order, regardless of browser vendor (I tried IE and Chrome).
From my observations using Fiddler, both IE and Chrome attempt negotiation using the first available supported method by that browser. i.e. in this case both IE and Chrome negotiated Kerberos authentication:
GET http://172.16.3.87:81/ HTTP/1.1
Host: 172.16.3.87:81
Connection: keep-alive
Authorization: Negotiate TlRMTVNTUAABAAAAl4II4gAAAAAAAAAAAAAAAAAAAAAGAbEdAAAADw==
If you base64 decode the Negotiate
value it says:
NTLMSSP
It is possible to remove the Kerberos (Negotiate) method by doing:
<system.webServer>
<security>
<authentication>
<windowsAuthentication enabled="true">
<providers>
<remove value="Negotiate" />
</providers>
</windowsAuthentication>
<basicAuthentication enabled="true" />
</authentication>
</security>
</system.webServer>
However trying to change the order of these by doing the following will have no effect:
<system.webServer>
<security>
<authentication>
<windowsAuthentication enabled="true">
<providers>
<remove value="Negotiate" />
<remove value="NTLM" />
<add value="NTLM" />
<add value="Negotiate" />
</providers>
</windowsAuthentication>
<basicAuthentication enabled="true" />
</authentication>
</security>
</system.webServer>
You will still be sent the WWW-Authenticate:
headers in the order of:
WWW-Authenticate: Negotiate
WWW-Authenticate: NTLM
WWW-Authenticate: Basic realm="172.16.3.87"