Apply service-account credentials¶
This operation switches the HTTP client's outbound NTLM identity from the ambient process account to an explicit service-account username and password, typically supplied by the host application after it decrypts a secure configuration setting.
| Field | Value |
|---|---|
| Operation ID | OP-DBC-02 |
| Trigger | Called by ServiceExtensions.RegisterDBConnectionClient immediately after it decrypts the connectionservicecreds secure setting |
| Inputs | username, password |
| Outputs | None (side effect only: NTLM credentials applied to the HTTP client) |
| Primary components | ConnectionClient.SetupClientCredentials |
| Entry point | src/SAIF.NetCore.DbConnectionClient/SAIF.NetCore.DBConnectionClient/SAIF.NetCore.DBConnectionClient/ConnectionClient.cs |
Steps¶
- Replace the current-identity NTLM configuration with explicit credentials:
HttpClient.SetNtlmAuthentication(username, password)(BR-DBC-03). - 1.1. This library calls only
IHttpJsonClient.SetNtlmAuthentication(username, password); when the standardHttpJsonClientimplementation is registered, that call builds anNtlmAuthenticatorfrom the suppliedusername/passwordand stores it on the client instance as_authenticator, replacing the parameterless (current-identity) authenticator set during Construct and configure the client. The stored authenticator is only assigned to aRestClientlater, insideCreateClient, each time that implementation builds a newRestClientfor an outbound request. A differently registeredIHttpJsonClientimplementation is not required to construct anNtlmAuthenticatoror assign it the same way.
Origin: Step 1.1 is implemented in Configure authentication (
SAIF.NetCore.HttpClients,HttpJsonClient.SetNtlmAuthentication(string,string)/CreateClient) when the standardHttpJsonClientimplementation is registered, and executed on behalf of this operation. - Neitherusernamenorpasswordis validated before being passed through.
Process flow¶
flowchart TD
Start([SetupClientCredentials called]) --> Ntlm[SetNtlmAuthentication with explicit username/password]
Ntlm --> Done([HTTP client now authenticates as service account])
Failure and edge-case behavior¶
- No input validation: an empty or malformed
username/passwordis passed straight toIHttpJsonClient.SetNtlmAuthenticationwithout this library detecting the problem. - Because
SetupClientCredentialsisvirtual, a subclass can change or skip credential replacement entirely.
Related documentation¶
Sources¶
src/SAIF.NetCore.DbConnectionClient/SAIF.NetCore.DBConnectionClient/SAIF.NetCore.DBConnectionClient/ConnectionClient.cssrc/SAIF.NetCore.HttpClients/SAIF.NetCore.HttpClients/SAIF.NetCore.HttpClients/HttpJsonClient/HttpJsonClient.cs(SetNtlmAuthentication(string,string),CreateClient— collaborator detail reached when the standardIHttpJsonClientimplementation is registered)