Chapter 02 / 09
ENSK

SmartExchange · .NET 10 · Chapter 02

Packages and boundaries

Four .NET 10 libraries currently live in MicroApps. They are the shared code to publish as NuGet packages for both consumers.

Shared code · Intaker + Web APIReviewed · 2026-10-27

Current projects → shared packages

ProjectClasses and interfacesResponsibility
BmcGroup.Authorization.ContractsAuthorizationGrant, AuthorizationPrincipal, request/resource/plan records; IAuthorizationGrantReader, IAuthorizationContextResolver, IAuthorizationPolicyClient; expression records.Stable contracts independent of Cerbos transport and SQL. Four source files.
BmcGroup.Authorization.SmartExchangeLegacySqlAuthorizationGrantAdapter, SmartExchangeAuthorizationContextResolver, SmartExchangeAuthorizationRelationshipRegistry, SmartExchangeAuthorizationScopeValidator.SmartExchange grant facts, scope normalization/validation and CRM relationship metadata.
BmcGroup.Authorization.CerbosCerbosAuthorizationPolicyClient, CerbosQueryPlanMapper, AuthorizationOptions, CerbosAuthorizationOptions.Reusable gRPC connection, PlanResources request and response mapping.
BmcGroup.Authorization.SqlKataIAuthorizationQueryAdapter, SqlKataAuthorizationQueryAdapter, AuthorizationSqlMappingFactory; SQL mapping/value/relationship records.Translate the supported plan into a parameterized query using trusted mappings.

BmcGroup.CRM and BmcGroup.CRM.Diagram already belong to the NuGet solution. They provide entity annotations and generated metadata to SmartExchange authorization.

Location is still POC. All four authorization projects remain in the MicroApps solution. Moving/publishing them is pending; no package merge has been implemented. Applications must consume the published libraries through PackageReference, never a cross-solution reference to a NuGet source project.

What stays in each application

Intaker · MicroAppsWeb API · its own solution
MicroApplication.OnInitialization(): create the client from configuration.Configure the same client with the same connection contract.
OnMessageAxtionExportXlsx: user/product, template and export workflow.Endpoint: authenticated user/product, action and entity query.
ExportAuthorizationResourceCatalog.GetMapping() and ExportQueryBuilder.ApplyAuthorizationPlan().Supply API query aliases/mappings and call the shared SQL adapter before count/paging.

Web API will use the same four authorization packages plus matching CRM metadata dependencies. SqlKata is reusable outside Intaker. A different query technology would need another enforcement adapter; grant resolution and Cerbos planning remain shared.

Delivery boundary

Move the shared libraries into the NuGet solution → publish a compatible package set → switch Intaker to package references → integrate Web API. Neither ExportQueryBuilder nor template/plugin processing moves into the shared authorization layer.

Same packages for both exports

Shared callPerson exportInterestedParty export
ResolveAsync()Person + Company grantsInterestedParty + Project + Investor grants
PlanResourcesAsync()Person / exportInterestedParty / export
GetRelationships() + Create()companyIds → PersonInCompany → CompanyprojectIds → Project
Apply()Append Company EXISTSAppend Project EXISTS

These are configuration/data differences, not two separate authorization implementations. Both documentation policies and their requests are clearly separated from the deployed default version.