Support NTLM password substitution in DEBUG mode

In DEBUG builds, replace "%NTLM_PW%" in NTLM auth password with a value from config. This enables dynamic credential testing without hardcoding passwords.
This commit is contained in:
2026-03-16 13:18:24 +01:00
parent 382eef0089
commit f15725ade2

View File

@@ -95,9 +95,14 @@ public class InvokeRecActionViewCommandHandler(
case EndpointAuthType.NtlmAuth:
if (!string.IsNullOrWhiteSpace(action.EndpointAuthUsername))
{
var endpointAuthPassword = action.EndpointAuthPassword
#if DEBUG
?.Replace("%NTLM_PW%", config?.GetValue<string>("%NTLM_PW%"))
#endif
;
var credentials = new NetworkCredential(
action.EndpointAuthUsername,
action.EndpointAuthPassword,
endpointAuthPassword,
action.EndpointAuthDomain);
var credentialCache = new CredentialCache { { httpReq.RequestUri!, "NTLM", credentials } };
httpReq.Options.Set(new HttpRequestOptionsKey<CredentialCache>("Credentials"), credentialCache);