Totallytech.BranchAuth.AspNetCore 1.1.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.

  • Totallytech.BranchAuth.Diagnostics: step-by-step HTTP tracing, no ASP.NET Core dependency (console apps and workers too). services.AddHttpTracing(configuration) logs every outgoing call of every HttpClient; in a web service app.UseHttpTracing() (Totallytech.BranchAuth.AspNetCore) logs every incoming request; with headers and bodies; secrets become [redacted] and tokens a fingerprint plus their claims. Off unless HttpTrace:Enabled is true.

See the token-broker repository README for configuration.

No packages depend on Totallytech.BranchAuth.AspNetCore.

Version Downloads Last updated
1.1.0 6 11/18/2026
1.0.0 2 11/16/2026