Register client-side services¶
Registers the ICurrentUserService implementation a client app needs to resolve the current user's name for outbound OnBehalfOfUser header configuration.
| Field | Value |
|---|---|
| Operation ID | OP-03 |
| Trigger | Consumer ConfigureServices (client application) |
| Inputs | ClientAppType (default Mvc) |
| Outputs | ICurrentUserService registered |
| Primary components | IServiceCollectionExtensions.AddNtmlApiAuthorizationClientServices(ClientAppType) |
| Entry point | src/SAIF.NetCore.NtlmApiAuth/src/SAIF.NetCore.NtlmApiAuth/Extensions/IServiceCollectionExtensions.cs |
Steps¶
- If
appType == Mvc(default), registerICurrentUserService→MvcCurrentUserService(Scoped); otherwise registerICurrentUserService→BlazorCurrentUserService(Scoped). (BR-NTLM-013)
Process flow¶
flowchart TD
Start([ConfigureServices]) --> D{appType?}
D -->|Mvc default| S1[Register MvcCurrentUserService]
D -->|Blazor| S2[Register BlazorCurrentUserService]
S1 --> End([ICurrentUserService registered])
S2 --> End
Failure and edge-case behavior¶
- Calling this method after
AddNtlmApiAuthorization<T>()(or vice versa) re-registersICurrentUserService; the last call wins because registrations useAdd*, notTryAdd*.
Related documentation¶
Sources¶
src/SAIF.NetCore.NtlmApiAuth/src/SAIF.NetCore.NtlmApiAuth/Extensions/IServiceCollectionExtensions.cs