Skip to content

Commit

Permalink
Authentication should be taken into account, #93.
Browse files Browse the repository at this point in the history
  • Loading branch information
yallie committed Dec 5, 2024
1 parent f8abb35 commit ff483f3
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 7 deletions.
30 changes: 30 additions & 0 deletions CoreRemoting.Tests/RpcTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -679,5 +679,35 @@ void Roundtrip<T>(T payload, int maxSize) where T : class
}
}
}

[Fact]
public void Authentication_is_taken_into_account()
{
_serverFixture.Server.Config.AuthenticationRequired = true;
try
{
using var client = new RemotingClient(new ClientConfig()
{
ConnectionTimeout = 0,
InvocationTimeout = 0,
SendTimeout = 0,
Channel = ClientChannel,
MessageEncryption = false,
ServerPort = _serverFixture.Server.Config.NetworkPort,
});

client.Connect();

var proxy = client.CreateProxy<IFailingService>();
var ex = Assert.Throws<RemoteInvocationException>(() => proxy.Hello());

// Session is not authenticated
Assert.Contains("authenticated", ex.Message);
}
finally
{
_serverFixture.Server.Config.AuthenticationRequired = false;
}
}
}
}
15 changes: 8 additions & 7 deletions CoreRemoting.Tests/Tools/FailingService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@ namespace CoreRemoting.Tests.Tools;

public class FailingService : IFailingService
{
public FailingService()
{
throw new NotImplementedException();
}
public FailingService()
{
Console.WriteLine("FailingService constructor was called!");
throw new NotImplementedException();
}

public void Hello()
{
}
public void Hello()
{
}
}

0 comments on commit ff483f3

Please sign in to comment.