Zum Hauptinhalt springen

AdapterAccessTokenServiceCollectionExtensions

Namespace: Meshmakers.Octo.Sdk.Common.Adapters

Registers the adapter's own credential refresh (AB#5072) into the holder of the connection it belongs to (AB#5865). Shared by AdapterBuilder and WebAdapterBuilder.

public static class AdapterAccessTokenServiceCollectionExtensions

Inheritance Object → AdapterAccessTokenServiceCollectionExtensions

Methods​

AddAdapterAccessTokenService(IServiceCollection, Boolean)​

Adds AdapterAccessTokenService as a singleton and hosted service.

public static IServiceCollection AddAdapterAccessTokenService(IServiceCollection services, bool isPoolMember)

Parameters​

services IServiceCollection

isPoolMember Boolean

Returns​

IServiceCollection

Remarks:

A dedicated adapter writes its own token into the process-wide , which its adapter hub connection and every service client read — one identity for the whole process.

🔴 A pool member has two identities and therefore two holders: its own (the lending pool's tenant), which only the pool hub connection presents, and the lease identity in the process-wide holder (the borrower's token during a lease, empty between leases). The own credential goes into AdapterPoolHubAccessToken. With one shared holder a hub reconnect during a lease authenticated the management connection as the borrower, and this refresh could overwrite a borrower token in the middle of a lease.

Must be called before the hosted services that open a hub connection: hosted services start sequentially and the first connection should already carry a token.