feat: execute full-repo remaining parity closure plan
This commit is contained in:
28
tests/NATS.Server.Tests/Auth/ProxyAuthTests.cs
Normal file
28
tests/NATS.Server.Tests/Auth/ProxyAuthTests.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using NATS.Server.Auth;
|
||||
using NATS.Server.Protocol;
|
||||
|
||||
namespace NATS.Server.Tests;
|
||||
|
||||
public class ProxyAuthTests
|
||||
{
|
||||
[Fact]
|
||||
public void Proxy_authenticator_maps_prefixed_username_to_identity()
|
||||
{
|
||||
var authenticator = new ProxyAuthenticator(new ProxyAuthOptions
|
||||
{
|
||||
Enabled = true,
|
||||
UsernamePrefix = "proxy:",
|
||||
Account = "A",
|
||||
});
|
||||
|
||||
var result = authenticator.Authenticate(new ClientAuthContext
|
||||
{
|
||||
Opts = new ClientOptions { Username = "proxy:bob" },
|
||||
Nonce = [],
|
||||
});
|
||||
|
||||
result.ShouldNotBeNull();
|
||||
result.Identity.ShouldBe("bob");
|
||||
result.AccountName.ShouldBe("A");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user