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