feat: execute full-repo remaining parity closure plan
This commit is contained in:
30
tests/NATS.Server.Tests/Auth/AuthExtensionParityTests.cs
Normal file
30
tests/NATS.Server.Tests/Auth/AuthExtensionParityTests.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
using NATS.Server.Auth;
|
||||
using NATS.Server.Protocol;
|
||||
|
||||
namespace NATS.Server.Tests;
|
||||
|
||||
public class AuthExtensionParityTests
|
||||
{
|
||||
[Fact]
|
||||
public void Auth_service_uses_proxy_auth_extension_when_enabled()
|
||||
{
|
||||
var service = AuthService.Build(new NatsOptions
|
||||
{
|
||||
ProxyAuth = new ProxyAuthOptions
|
||||
{
|
||||
Enabled = true,
|
||||
UsernamePrefix = "proxy:",
|
||||
},
|
||||
});
|
||||
|
||||
service.IsAuthRequired.ShouldBeTrue();
|
||||
var result = service.Authenticate(new ClientAuthContext
|
||||
{
|
||||
Opts = new ClientOptions { Username = "proxy:alice" },
|
||||
Nonce = [],
|
||||
});
|
||||
|
||||
result.ShouldNotBeNull();
|
||||
result.Identity.ShouldBe("alice");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user