I have a very simple client / server test that does not work with the message:
Server rejected client credentials.
If the client is not registered as an account with administrator rights on the server. I don’t want that.
Here is my client code:
var formatter = new BinaryFormatter();
...
using (var client = new TcpClient(ip, 1248))
using (var stream = client.GetStream())
using (var negStream = new NegotiateStream(stream, false))
{
await negStream.AuthenticateAsClientAsync(CredentialCache.DefaultNetworkCredentials, string.Empty, ProtectionLevel.EncryptAndSign, TokenImpersonationLevel.Identification));
formatter.Serialize(negStream, "This is a test!");
}
And here is my server code:
var listener = new TcpListener.Create(1248);
listener.Start();
var tcpClient = listener.AcceptTcpClient();
using (var stream = tcpClient.GetStream())
using (var negStream = new NegotiateStream(stream, false))
{
await negStream.AuthenticateAsServerAsync(CredentialCache.DefaultNetworkCredentials, ProtectionLevel.EncryptAndSign, TokenImpersonationLevel.Identification));
Console.WriteLine(formatter.Deserialize(negStream));
}
How to configure the server to accept any registered user? Is there another setting I need to look at? Is there another way to authenticate a stream with domain credentials?
source
share