feat: port session 11 — Accounts & Directory JWT Store

- Account: full Account class (200 features) with subject mappings,
  connection counting, export/import checks, expiration timers
- DirJwtStore: directory-based JWT storage with sharding and expiry
- AccountResolver: IAccountResolver, MemoryAccountResolver,
  UrlAccountResolver, DirAccountResolver, CacheDirAccountResolver
- AccountTypes: all supporting types (AccountLimits, SConns, ExportMap,
  ImportMap, ServiceExport, StreamExport, ServiceLatency, etc.)
- 34 unit tests (599 total), 234 features complete (IDs 150-349, 793-826)
This commit is contained in:
Joseph Doherty
2026-02-26 15:37:08 -05:00
parent 06779a1f77
commit 12a14ec476
14 changed files with 5297 additions and 66 deletions

View File

@@ -168,45 +168,5 @@ public class RoutePermissions
public SubjectPermission? Export { get; set; }
}
/// <summary>
/// Stub for Account type. Full implementation in session 11.
/// Mirrors Go <c>Account</c> struct.
/// </summary>
public class Account : INatsAccount
{
public string Name { get; set; } = string.Empty;
// Fields required by session 09 account management (NatsServer.Accounts.cs).
// Full implementation in session 11.
public string Issuer { get; set; } = string.Empty;
internal string ClaimJwt { get; set; } = string.Empty;
internal int RoutePoolIdx { get; set; }
internal bool Incomplete { get; set; }
internal DateTime Updated { get; set; }
internal ZB.MOM.NatsNet.Server.Internal.DataStructures.SubscriptionIndex? Sublist { get; set; }
internal object? Server { get; set; } // INatsServer — avoids circular reference
// INatsAccount — stub implementations until session 11 (accounts.go).
bool INatsAccount.IsValid => true;
bool INatsAccount.MaxTotalConnectionsReached() => false;
bool INatsAccount.MaxTotalLeafNodesReached() => false;
int INatsAccount.AddClient(ClientConnection c) => 0;
int INatsAccount.RemoveClient(ClientConnection c) => 0;
/// <summary>Returns true if this account's JWT has expired. Stub — full impl in session 11.</summary>
public bool IsExpired() => false;
/// <summary>
/// Returns the total number of subscriptions across all clients in this account.
/// Stub — full implementation in session 11.
/// Mirrors Go <c>Account.TotalSubs()</c>.
/// </summary>
public int TotalSubs() => 0;
/// <summary>
/// Notifies leaf nodes of a subscription change.
/// Stub — full implementation in session 15.
/// Mirrors Go <c>Account.updateLeafNodes()</c>.
/// </summary>
internal void UpdateLeafNodes(object sub, int delta) { }
}
// Account stub removed — full implementation is in Accounts/Account.cs
// in the ZB.MOM.NatsNet.Server namespace.