Architecture
This page documents Orleans.Lattice.Membership.Entra.Graph 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.Orleans.Lattice.Membership.Entra.Graph plugs two Microsoft Graph-backed implementations into seams other packages declare: the Entra authenticator's IEntraGroupResolver and the membership package's ILatticeIdentityDirectory. Both share one app-only Graph client. This page describes the pipeline by behaviour; the public types are listed in the Public API.
Registration
AddEntraGraphGroupResolver refuses to run unless AddEntraCredentialAuthenticator(...) has been called first. It then applies the configure delegate and validates the options at once: exactly one authentication mode must be fully configured, Scopes must hold at least one non-empty scope, and TokenRefreshSkew must not be negative. Any violation throws OptionsValidationException before a service is registered. Three singletons follow:
- The Graph client. With
Credentialset, the client is built directly from thatTokenCredentialandScopes; no client secret is involved. Otherwise it is built over an MSAL confidential client forClientId,ClientSecretand the authority fromResolveAuthority(), wrapped in the token cache described below. - The group resolver, registered as
IEntraGroupResolver, using the shared client andSecurityEnabledOnly. - The identity directory,
EntraGraphIdentityDirectory, registered asILatticeIdentityDirectoryso it replaces the membership package's no-op default. It reads the page-size bounds fromLatticeIdentityDirectoryOptionsand records principal ids perDirectorySubjectIdSource.
The Entra authenticator picks up the resolver when it is first constructed, so the resolver is consulted only if that authenticator's GroupResolutionMode is ResolveOnOverage.
App-only token management
On the client-secret path, a token provider sits between the Graph client and MSAL. It caches the app-only token and treats it as expired TokenRefreshSkew before its real expiry, so a call never carries a token that expires in flight. When the cache is cold or stale, concurrent callers share one in-flight acquisition, so a burst of lookups makes one request to the token endpoint. An expired token is re-acquired on the next request.
Overage resolution
When the Entra authenticator meets a token whose groups claim overflowed, the resolver calls Graph's getMemberGroups for the caller, which returns every transitive group (and directory role) id regardless of the token's group cap, restricted to security groups when SecurityEnabledOnly is set. The ids are returned to the authenticator, which unions them with the token's asserted groups. A token or Graph failure on this path propagates through authentication rather than yielding an empty group set, so a caller is never authenticated with silently missing groups. Tokens that carry their groups inline never reach Graph.
Identity directory
Search issues server-side searched (or browsed) and paged Graph queries over /users and /groups, honouring the requested principal kind - a search across both kinds pages through users first, then groups - and clamping the page size to LatticeIdentityDirectoryOptions. A search term is matched against display name, user principal name and mail for users and against display name and mail for groups, with any double quote or backslash removed first so the term cannot break out of the quoted search clause; an empty term browses in display-name order. A continuation token is replayed only when it is an absolute https URL on the configured Graph host and port with no embedded credentials, so a tampered token cannot redirect the app-only client to another host; any other token is treated like a Graph denial and yields an empty page. Resolve looks a principal up by exact id and returns null when Graph reports it not found. Each principal's id is shaped by DirectorySubjectIdSource - the object id by default - so a validated id matches the subject the authenticator resolves. When Graph denies a query (for example, the app lacks User.Read.All or Group.Read.All), search returns an empty page and resolve returns null instead of faulting; token-acquisition and non-Graph transport failures are not caught here. The directory is used only by administration and the Explorer, never during subject resolution (Identity-directory providers).