views:

264

answers:

4

is there a managed code (without adding COM component or wrapped called to C++ routines) way to add integrated security to a C# Managed code assembly?

i.e. I want to write a client-server system where the server uses Remoting instead of IIS, but I want the client to automatically pass it's credentials to the server just like a browser does when communicating with an IIS server that has Integrated security enabled...

Can this be done? and if so, where is there some examples ?

A: 

When you say "remoting instead of IIS," what exactly do you mean? A remoting endpoint (the server end) is typically hosted in IIS since this gives you lots of stuff for free, like authentication, scaling through load balancing - especially for singlecall type objects - that is to say, you don't want to keep state for successive calls to the endpoint.

You can host a remoting endpoint using the http stack in a client app also in xp/sp2 and beyond utilising the http.sys driver directly (which is handleded automatically for you btw).

Regardless, for automatic logon with NTLM credentials, I suggest you host remoting in IIS, and use System.Net.CredentialCache.DefaultCredentials for the client's credentials your client app. This will pass the context credentials to the server app, presuming the current security zone (intranet/internet/trusted/etc) allows it.

-Oisin

x0n
I mean without using IIS... Using tcp/ip channels instead, using System.Runtime.Remoting and System.Runtime.Remoting.Channels.Tcp:RemotingConfiguration.RegisterWellKnownServiceType( );
Charles Bretana
Cause I want to use tcp binary protocol - don't want to incur the restrictions imposed by IIS to get the free stuff, ... that's exactly my question... How do I do this (authentication myself?
Charles Bretana
+4  A: 

No - there is no pure managed interface to SSPI. But, there is an MSDN sample that wraps SSPI for you, and then uses the wrapper for remoting.

Mark Brackett
Ah you freaken SAVIOUR!!!! The only thing I could find on the tubes was that there was a wrapper - not where it was! Thanks a million.
Jonathan C Dickinson
+1  A: 

.NET 2 has NegotiateStream which is used by TCP remoting to provide SSPI.

NathanE
A: 

there is WCF and all .net libraries for you to implement something like that. I used something like this

http://www.theproblemsolver.nl/usingthemembershipproviderinwinforms.htm

and for the server part

http://weblogs.asp.net/dwahlin/archive/2007/02/03/video-creating-a-service-with-windows-communication-service-wcf.aspx

those two steps nice to start a own implemented security integration.