Hi Steven,
Thanks for your response; sorry I haven't got back to you sooner - got a bit
tied up in an implementation elsewhere! I haven't yet had time to have more
than a cursory read through the entire MSDN article you pointed out, but
from what I've read I'm thinking that I may still have a problem.
Your reading of the situation was spot on, and I believe that the WebService
is behaving as you stated in point 1. My intermediate solution was to set
the authentication mode to windows and impersonate the user, storing the
username and password in the web.Config file (as I think it mentions in the
How To document); this was then encrypted. The UsernameToken class then uses
this username and password to authenticate (as does the rest of the
application).
I should mention at this point that I'm testing on WinXP, but the behaviour
is the same on Win2K3; I noticed the article has a section specifically on
Windows Server 2003, so I'll concentrate on that over the next couple of
days.
I'm probably missing something really basic here (as is usually the way!),
as I can't understand why the UsernameToken class, compiled and included as
part of the dll hosted in the IIS session with the IIS Authentication set to
anonymous and the username and password provided, is deciding to revert to
the default ASPNet/Network Service user.
As you mentioned as your second point, the other option is that the WSE
runtime has manually reverted, although I can't see why it would do it for
one setting and not the other!
I'm not too keen on having the web.config file holding the Username and
Password, even if it is encrypted; ideally we'd be using the IIS Anonymous
access username and password.
I'll post back once I've had a time to go through the article in more detail
(hopefully the next couple of days!); my last remaining hope is configuring
an application pool in IIS6 on Server 2003 to use a specific user ID will
force all applications under it to use the same ID!
If you need any more information or have any other ideas, please let me
know!!!
As I've said, I'm probably missing something totally basic - I'll post back
once I've managed to get a Windows Server 2003 machine to test on.
Thanks for your help!
Cheers,
Dave
Steven Cheng[MSFT] - 08 Aug 2007 07:52 GMT
Thanks for your followup Dave,
I'm sorry to hear that the problem still remains. As for the following
things you mentioned:
===============
My intermediate solution was to set
the authentication mode to windows and impersonate the user, storing the
username and password in the web.Config file (as I think it mentions in the
How To document); this was then encrypted. The UsernameToken class then
uses
this username and password to authenticate (as does the rest of the
application).
===============
do you mean you use the following like configuration to impersonate the
ASP.NET appliation running under your specific account?
<identity impersonate="true" userName="domain\username"
password="password..." />
If so, I'm afraid this won't work either (just like you try impersonating
the anonymous account configured in IIS), the impersonation of ASP.NET
always take place in the fixed stage during ASP.NET webservice(or web
application)'s sever-side processing pipeline, at that time, the
usernameTokenManager has already done the authentication(not be able to
utilize the impersonated security context).
Have you tried using the code to programmatically do the impersonate and
use those code in your custom UsernameTokenManager's implementeation code?
I mean you can add programmatic impersonate code in your custom token
authenticator's code(where you connect to database to query user info);
http://msdn2.microsoft.com/en-us/library/ms730079.aspx
e.g.
=====in your custom token's impelementation========
public bool authenticate_method(username , password)
{
//begin impersonate
connect to remote database and verify the user account here
//revert back
}
Anyway, please don't hesitate to post here if you have any questions or
anything unclear on this.
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.
Steven Cheng[MSFT] - 10 Aug 2007 11:18 GMT
Hi Dave,
How are you going on this issue? Does my last reply still help some?
As always, if you need any further help from us, please feel free to post
in the newsgroup.
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.