feat: add auth model types (User, NKeyUser, Permissions) and auth config to NatsOptions

This commit is contained in:
Joseph Doherty
2026-02-22 22:21:00 -05:00
parent 11dc5e62f3
commit 5305069dd8
5 changed files with 77 additions and 0 deletions

View File

@@ -1,3 +1,5 @@
using NATS.Server.Auth;
namespace NATS.Server;
public sealed class NatsOptions
@@ -10,4 +12,19 @@ public sealed class NatsOptions
public int MaxConnections { get; set; } = 65536;
public TimeSpan PingInterval { get; set; } = TimeSpan.FromMinutes(2);
public int MaxPingsOut { get; set; } = 2;
// Simple auth (single user)
public string? Username { get; set; }
public string? Password { get; set; }
public string? Authorization { get; set; }
// Multiple users/nkeys
public IReadOnlyList<User>? Users { get; set; }
public IReadOnlyList<NKeyUser>? NKeys { get; set; }
// Default/fallback
public string? NoAuthUser { get; set; }
// Auth timing
public TimeSpan AuthTimeout { get; set; } = TimeSpan.FromSeconds(1);
}