all groups > dotnet remoting > july 2006 >
You're in the

dotnet remoting

group:

problem with credentials in remoting


problem with credentials in remoting ThunderMusic
7/26/2006 4:44:47 PM
dotnet remoting:
Hi,
Let me explain my architecture : Client-->ServerA-->ServerB

So, Client makes a call to ServerA which returns an object gotten from
ServerB... The credentials are passed from Client to ServerB my using
Impersonation on ServerA...

The problem is the following :
ServerB is a Windows Service... it starts a process (worker thread)...
when the service starts it, it starts with the Service's credentials, which
is fine... When the Client calls StopProcess() the thread finishes with the
Service's credentials (like it started), but when the Client calls
StartProcess(), the thread is restarted but with the Client's credentials
because Thread.CurrentPrincipal is now the Client's credentials... Is it
really what's happenning? (it really seems to be)

Is there a solution to this? Is it possible to tell the thread to work on
specific credentials? and is it possible to get the service credentials
back?

thanks

ThunderMusic

Re: problem with credentials in remoting Lancelot NO[at]SPAM community.nospam
7/26/2006 4:57:57 PM
Hi Thunder,
You can tell you thread to revert to itself in order to perform some
task.


// Switch to the 'orignal' identity
WindowsImpersonationContext context =
WindowsIdentity.Impersonate( IntPtr.Zero );
try
{
// do your stuff.
}
finnaly
{
// Back to the caller's identity
context.Undo();
}

This will switch your server to its primary identity, the identity under
which it runs. Once you are done, just switch back.

Good luck

-Martin

[quoted text, click to view]

Re: problem with credentials in remoting ThunderMusic
7/27/2006 8:19:48 AM
Excellent!! thanks a lot

[quoted text, click to view]

AddThis Social Bookmark Button