views:

239

answers:

2

I'm looking for the best/easiest way to add extensions to an existing protocol (can't change the actual protocol easily) to allow the user to do windows authentication (NTLM?) in .NET. I looked at the AuthenticationManager class already but it requires that I use Web(Http)Request which isn't an option. NegotiateStream is an option either as I want to integrate this into the existing protocol, not wrap it into a new one. Are there any options besides these two available to me ?

A: 

I assume since you can't do an HTTPRequest, that this is a piece of desktop software.

Active Directory and LDAP are the protocols you are most likely going to be using.

I think System.Environment, and System.DirectoryServices are going to be the places to look to start.

I like DirectorySearcher, and Environment.UserName for getting just about any information on a user.

I hope this helps.

Penguinix
A: 

If you can only extend your protocol then one way to do this would be to write your own Stream class that you pass to NegotiateStream and then just take the messages that NegotiateStream gives you and put in your own protocol and give responses back to NegotiateStream through your Stream class. But if possbile, the easiest way would be to wrap your entire protocol (Stream) inside a NegotiateStream...

Pent Ploompuu