Totallytech.BranchAuth.EntityFrameworkCore 1.0.0

Totallytech.BranchAuth

Helpers for calling and receiving branch-scoped internal APIs through the token broker. Built for .NET 8 and .NET 10.

  • Totallytech.BranchAuth.Client: IBranchTokenClient.GetAsync(companyId, branchId, scope) gets a short-lived access token from the broker. The service proves its identity with its own identity server client (BranchTokenClient:CallerAuth = ClientCredentials, secret from its secret store) or, on Kubernetes, with the pod's projected service account token (ServiceAccountToken). Tokens are cached in memory until about 60 seconds before they expire.
    • BranchNotEntitledException: the branch does not have the service or scope. This is a normal case and is not retried.
    • Broker 503, 429 and network errors are retried with backoff.
  • Totallytech.BranchAuth.AspNetCore for receiving services:
    • Already validating tokens from the identity server: builder.Services.AddBranchTenantAuthorization() (adds only the scope policies and ITenantContext).
    • No token validation yet: builder.AddBranchApiAuth("rcm") (JWT bearer validation against BranchApiAuth:Authority with the given audience, plus the above).
    • A policy for every scope name: [Authorize(Policy = "rcm.claims.write")] or .RequireAuthorization("rcm.claims.write").
    • ITenantContext reads the companyId and branchId claims from the validated token only.
  • Totallytech.BranchAuth.EntityFrameworkCore: modelBuilder.ApplyBranchTenantFilters(this) adds a global query filter on CompanyId and BranchId to every ITenantScoped entity.

See the token-broker repository README for configuration.

No packages depend on Totallytech.BranchAuth.EntityFrameworkCore.

.NET 10.0

.NET 8.0

Version Downloads Last updated
1.0.0 0 11/16/2026