Orleans.Lattice.Api.TenantAdmin.Grpc architecture
This page documents Orleans.Lattice.Api.TenantAdmin.Grpc 10.5.0, in the documentation for Orleans.Lattice 10.5.0 (release line 10.5), built 2026-12-05. It is also published as markdown, with every table and list, at architecture.md, and llms.txt lists every page.This page describes how a remote call travels through the code-first gRPC binding to the tenant-administration facades, and the seams it passes on the way. The gRPC service, the method definitions, the marshallers, the authorization interceptor, the default credential bridge and the options-backed auth-scheme source are internal, so they are described here by behaviour; the public clients, options, seams and wire records are named.
The binding is a thin adapter. Tenant lifecycle, region residency, admin subjects, cross-tenant grants, quota usage, self-service and delegated tenant access all live in the facades, which are the single enforcement point for tenant and operator authority; see the facade architecture and facade guide. The binding adds a coarse transport gate in front of them and never replaces, widens or downgrades their decisions.
Request path
- Client. A
LatticeTenantAdminApiGrpcClientorLatticeTenantSelfServiceApiGrpcClientmethod checks its arguments fornulland empty values, wraps them in the RPC's request record and sends a unary call through the caller'sCallInvoker, passing only the caller's cancellation token. Headers, deadlines and TLS come from that invoker. - Wire. The request record is serialized with the Orleans binary serializer (see Code-first binding).
- Routing. ASP.NET Core endpoint routing dispatches the call to the service mapped by
MapLatticeTenantAdminApiGrpc. - Transport gate. The authorization interceptor decides whether an enforced call may run at all (see Transport gate).
- Service. The service stamps the caller's credential and asserted tenant onto the ambient context for this call only, calls the one facade member the RPC maps to, and translates the outcome into a gRPC status (see Facade gate and Status mapping).
- Facade. The facade authorizes the caller - as a platform operator, or as an admin of the tenant the request names, depending on the verb - and only then reads or changes tenancy state.
The response record travels back through the same marshalling, and the client returns the facade result, unwrapping the few RPCs whose response is an envelope (see API reference).
Code-first binding
The binding defines its RPCs in C#, not in a .proto. A method-definition set builds one unary gRPC method per RPC under the service name orleans.lattice.api.tenantadmin, each with a request and a response marshaller built from the Orleans Serializer<T> instances resolved from the service provider. The server-side service and both public clients build the same set, so every end agrees on method names and message types by construction; the API reference lists all 40 RPCs.
Each marshaller writes the encoded message straight into the gRPC stream's buffer writer, with no intermediate array. On the read side, a single-segment payload is deserialized in place; a multi-segment payload is copied into a pooled buffer that is returned after use.
Registration and mapping cooperate at startup. Registration provides the method-definition set as a singleton whose construction also publishes it to the static hook that Grpc.AspNetCore calls to bind the service's methods; MapLatticeTenantAdminApiGrpc resolves that singleton before mapping the service, so the hook never runs before the set exists.
Wire records this package defines carry stable oitng. aliases, and the facades' result records keep their oitn. aliases (see Wire compatibility). Contract evolution is additive: a member added to a record a request already carries - such as the delegated-access caps on TenantQuotasDescriptor - reads as null from a client that predates it.
Authorization
An enforced call passes two independent gates: the transport gate in this package, then the facade's own authorization. The transport gate is closed by default. The facades always run their checks, but what the platform-operator check decides depends on the Orleans.Lattice.Auth add-on: without it the core no-op access gate allows every check, so the transport gate is the only barrier; with it, the operator check is evaluated on the control plane and refuses an unmatched caller whatever LatticeAuthOptions.DefaultEffect is set to.
Transport gate
The authorization interceptor is added to the host's global gRPC pipeline, but it acts only on calls routed to this service. It identifies the call by the method it was routed to, read from the matched endpoint, never by the raw request path: routing matches paths case-insensitively, so a check on the raw path would let a re-cased path reach the handler without passing the gate. Calls to other gRPC services on the host pass through untouched.
For a call to this service, the interceptor:
- lets
GetAuthSchemethrough without a check, so a client can learn how to sign in before it holds a credential; - lets the three read-only self-service RPCs -
GetCurrentTenant,ListAccessibleTenantsandGetTenant- through without a check, so any read-capable caller, including an anonymous one, can reach them. Their scoping is enforced byILatticeTenantSelfService, not here: an anonymous caller lists nothing, and a caller only ever sees tenants it is authorized for; - lets every other call through when
LatticeTenantAdminApiGrpcOptions.RequireAuthorizationisfalse; - otherwise describes the call as a
LatticeTenantAdminApiAuthorizationContext- the routedOperation(one of the 36 namedLatticeTenantAdminApiOperationvalues, orUnknownfor an unrecognised method), theTargetId, and theServerCallContext- and asks the registeredILatticeTenantAdminApiAuthorizer; - refuses a denied call with
PermissionDenied, logging a warning, before the service or facade is touched. If the authorizer itself is cancelled, the call endsCancelled.
TargetId is the tenant id the request names. A cross-tenant grant request names two tenants, and the interceptor reports the granting tenant for every grant mutation, including the grantee-side approve and reject. It is a coarse hint for a transport policy; the authority each grant transition actually requires is decided, fail-closed, by ILatticeTenantGrantAdmin.
The default DenyTenantAdminApiAuthorizer refuses everything, so with the defaults no enforced call succeeds until a host registers a permissive authorizer or turns enforcement off behind an outer boundary. Presenting a credential is not enough on its own. The interceptor applies the same check to streaming call shapes, deciding before the first message is read, although every RPC this service defines is unary.
Facade gate
The service runs after the transport gate - and, for the exempt RPCs, without it - and is where the caller's identity enters the request:
- Credential. The registered
ILatticeTenantAdminApiCredentialBridgelifts aLatticeCredentialfrom the call. The default bridge reads theCredentialHeaderNameheader, strips a leadingCredentialSchemeprefix, and performs no validation - a registered credential authenticator validates the token. When the bridge returns a credential, the service opens aLatticeCredentialContextscope for the call; when it returnsnullthe caller is anonymous. - Asserted tenant. The service reads the
ActiveTenantHeaderNameheader throughLatticeActiveTenantAssertionand, for a syntactically valid tenant id, opens aLatticeActiveTenantContextscope. An absent, blank or invalid value opens no scope, and the caller resolves the reserveddefaulttenant. The value is only an assertion: the tenancy engine re-validates it against the caller's membership, and an assertion the caller may not use is refused asPermissionDenied.
Both scopes are opened for every RPC except GetAuthScheme, the self-service RPCs included, and both are disposed when the call completes, so a credential or tenant never leaks into another call. Both are opened even when RequireAuthorization is false: switching the transport gate off does not switch off the facades' checks.
The lifecycle, region-residency, admin-subject, grant, quota-usage and delegated-access RPCs authorize on the caller's subject and the tenant the request names, not on the asserted active tenant. For the delegated-access RPCs the facades authorize the caller before they check the feature flag, the reserved default tenant or anything else, so a denied caller learns nothing; the binding adds no authorization path of its own for them. Names, trees and rule ids travel tenant-local and are composed into full ids by the facade, never accepted from the wire as full ids.
GetAuthScheme is served without either scope: it reads the registered ILatticeTenantAdminApiAuthSchemeSource and returns its advertisement, which must contain only public configuration.
Optional facades
The service requires ILatticeTenantAdmin and ILatticeTenantSelfService. It takes ILatticeTenantRegionAdmin, ILatticeTenantQuotaUsage, ILatticeTenantAccessAdmin, ILatticeTenantGrantAdmin, ILatticeTenantDirectoryAdmin and ILatticeTenantPolicyAdmin as optional dependencies, so a host that registers the binding without one of them still starts and serves every lifecycle and self-service RPC, and the RPCs of the missing facade answer Unimplemented. AddLatticeTenantAdminApi registers all of them.
Status mapping
Each RPC group - lifecycle and quotas, quota usage, region residency, admin subjects, cross-tenant grants, self-service, and delegated tenant access - translates its facade's outcomes into explicit gRPC statuses at its own boundary, so a domain exception never falls through to an opaque fault. The groups share one vocabulary but not every arm: for example an InvalidOperationException is FailedPrecondition on the lifecycle, residency, subject, grant and delegated-access RPCs, but is not mapped on the quota-usage and self-service RPCs. A status the service raised itself, such as Unimplemented, passes through unchanged. Anything unmapped is logged on the server and returned as Internal with a generic message, so exception text never reaches the client.
On the delegated-access RPCs a reached cap (LatticeQuotaExceededException) becomes ResourceExhausted, with the breached dimension, when the exception names one, in the lattice-quota-dimension trailer and, when the limit is positive, the usage and cap in lattice-quota-current and lattice-quota-limit. Neither the tree nor the tenant is sent back.
The full exception-to-status table, with the groups each arm applies to, is in the README's Status mapping.
Source map
- Registration and mapping
- Options
- Method definitions and marshallers
- Service and status mapping, with the delegated-access RPCs
- Authorization interceptor and routed-method resolution
- Default credential bridge
- Typed client and self-service client