---
title: Register client-side services
summary: Registers the current-user resolver used by client-side header helpers.
status: draft
owner: SAIF Platform Team
last_reviewed: 2026-10-02
library: SAIF.NetCore.NtlmApiAuth
reference_type: package
operation_id: OP-03
trigger: Consumer ConfigureServices (client app)
---

# 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

1. If `appType == Mvc` (default), register `ICurrentUserService` → `MvcCurrentUserService` (Scoped); otherwise register `ICurrentUserService` → `BlazorCurrentUserService` (Scoped). ([BR-NTLM-013](../business-rules.md#br-ntlm-013-current-user-source-depends-on-client-type))

## Process flow

```mermaid
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-registers `ICurrentUserService`; the last call wins because registrations use `Add*`, not `TryAdd*`.

## Related documentation
- [Operations and processes](../operations-processes.md)
- [Business rules](../business-rules.md)

## Sources
- `src/SAIF.NetCore.NtlmApiAuth/src/SAIF.NetCore.NtlmApiAuth/Extensions/IServiceCollectionExtensions.cs`
