Psst! Did you know DevelopmentNow is a mobile web site design agency?

Contact us for help mobilizing your site, or to sign up for our beta Mobile Web SDK!
all groups > iis security > march 2008 >

iis security : Anonymous and integrated authentication for Web service


iamahulk
3/26/2008 9:36:06 AM
Is it possible using IIS(version 6) to have both Anonymous and integrated
authentication for a web service?
By this I mean can it do intergrated authentication when the credentials
exist, but if they don't allow an anonymous connection? (For a single URL)
David Wang
3/26/2008 8:39:14 PM
On Mar 26, 9:36=A0am, iamahulk <iamah...@discussions.microsoft.com>
[quoted text, click to view]



Yes, IIS supports such "fallback" authentication protocol, but only if
the Web Service Client initiates it.

If the WebService Client always tries Integrated First and if it
fails, retry with Anonymous, then you can simply configure IIS6 Web
Service to allow both Anonymous and Integrated.

If you cannot control the client, then you will have to write and run
custom software on the server to enforce such proprietary behavior.
There are no standard authentication protocol which works like this.


//David
http://w3-4u.blogspot.com
http://blogs.msdn.com/David.Wang
iamahulk
3/27/2008 3:46:00 AM
I'm not sure if I understand what you're saying. Some clients will be
accessing the webservice while on our network and have windows credentials,
others from outside our network will call the service without credentials.
Given this are you saying they both can call the same web service?

Is this simply a matter of configuring the web service in IIS to:
Enable anonymous access
and
Integrated Windows authentication

Because I've read other posting where this doesn't work

[quoted text, click to view]
iamahulk
3/28/2008 5:42:00 AM
Thanks for the answer.

Can you tell me where to look for information on how to create a .net client
which will use credentials before trying anonymous?

I tried changing values in the UseDefaultCredentials and Credentials
properties, but it appears to always try anonymous, since the web service I'm
testing Isn't authenticating when I have anonymous enabled.


[quoted text, click to view]
David Wang
3/28/2008 6:32:02 AM
On Mar 28, 5:42=A0am, iamahulk <iamah...@discussions.microsoft.com>
[quoted text, click to view]


Change the client to .PreAuthenticate.

UseDefaultCredentials and Credentials property change the user
identity on authentication, not ordering of authentication.


//David
http://w3-4u.blogspot.com
http://blogs.msdn.com/David.Wang
iamahulk
3/28/2008 12:13:01 PM
David,
I did as you memtioned and it doesn't work
Here is client code
Dim oWS As New myServer.WebServiceMain
oWS.UseDefaultCredentials = True
oWS.Credentials = New System.Net.NetworkCredential("myID", "password",
"DOM")
oWS.PreAuthenticate = True
Dim oResponse As Object = oWS.Execute()

I am logging on the web service and it shows that the user in not
authenticated


[quoted text, click to view]


[quoted text, click to view]
iamahulk
3/28/2008 12:21:01 PM
Also might it have something to do with how my web reference is using the
SoapHttpClientProtocol

Partial Public Class WebServiceMain
Inherits System.Web.Services.Protocols.SoapHttpClientProtocol
......

[quoted text, click to view]
Ken Schaefer
3/28/2008 3:14:38 PM
Yes - David is saying that this can be done.

BUT

You need to write the client appropriately. An off-the-shelf HTTP client
(like a browser) doesn't work this way. It will just make an anonymous
request by default. Only if the server denies the request (with a 401) will
it ask the user for credentials.

In your case, you need to write a client that will automatically try
Integrated Windows Auth *first* rather than trying anonymous first (or a
client that detects whether it's on the internel network or not and adjusts
it's request appropriately)

Cheers
Ken

--
My IIS blog: http://adopenstatic.com/blog


[quoted text, click to view]
AddThis Social Bookmark Button