Skip to content

ImpersonatingWrapper target

Rolf Kristensen edited this page Dec 27, 2023 · 17 revisions

Impersonates another user for the duration of the write (Ex. give access-permission to file-target)

Platforms Supported: Limited - Windows only and requires nuget-package NLog.WindowsIdentity with NLog 5.0

Configuration Syntax

<targets>
  <target xsi:type="ImpersonatingWrapper"
          name="String"
          userName="Layout"
          password="Layout"
          domain="Layout"
          revertToSelf="Boolean"
          impersonationLevel="Enum"
          logOnType="Enum"
          logOnProvider="Enum">
    <target xsi:type="wrappedTargetType" ...target properties... />
  </target>
</targets>

Parameters

General Options

  • name - Name of the target.

Impersonation Options

  • userName - Username to change context to.

    NLog.WindowsIdentity v5.3 changed data-type from String to Layout

  • password - User account password.

    NLog.WindowsIdentity v5.3 changed data-type from String to Layout

  • domain - Windows domain name for user account. Default: .

    NLog.WindowsIdentity v5.3 changed data-type from String to Layout

  • revertToSelf - Indicates whether to revert to the credentials of the process instead of impersonating another user. Boolean Default: False

  • impersonationLevel - Required impersonation level.
    Possible values:

    • Anonymous - Anonymous Level.
    • Delegation - Delegation Level.
    • Identification - Identification Level.
    • Impersonation - Impersonation Level.
  • logOnType - Logon Type.
    Possible values:

    • Batch - Batch Logon.
    • Interactive - Interactive Logon.
    • Network - Network Logon.
    • NetworkClearText - Network Clear Text Logon.
    • NewCredentials - New Network Credentials.
    • Service - Logon as a Service.
  • logOnProvider - Type of the logon provider.
    Possible values:

    • Default - Use the standard logon provider for the system.
Clone this wiki locally