-
Notifications
You must be signed in to change notification settings - Fork 1.4k
AspNet User Claim Layout Renderer
ASP.NET User Claims authorization values.
Platforms Supported: All
Introduced with NLog.Web.AspNetCore v4.10.0, and with NLog.Web v5.1.0 for NET46
${aspnet-user-claim:ClaimTypes.Name}
ClaimType - default parameter. Key to lookup using ClaimsIdentity.FindFirst(string)
with fallback to ClaimsPrincipal.FindFirst(string)
. When value is prefixed with ClaimTypes.
(Remember dot) then it will lookup in well-known claim types from ClaimTypes-constants. For example ClaimsTypes.Name
NLog.Web.AspNetCore v5.3.3 supports outputting all values, when not having specified any ClaimType.
NLog.Web.AspNetCore v5.3.3 supports the following formatting options, when outputting all value by not specifying any ClaimType:
-
outputFormat - Renders as flat string or as JSON. Default:
Flat
.-
Flat
- Key-value-pair as standard string -
JsonArray
- Key-value-pair in JSON-array -
JsonDictionary
- Key-value-pair as JSON-dictionary
-
-
itemSeparator - Separator between items. Default:
,
. Only applies when OutputFormat isFlat
. -
valueSeparator - Separator between value and key. Default:
=
. Only applies when OutputFormat isFlat
. -
ValuesOnly - Only render the values of the key/value pairs. Default:
false
. -
LowerCaseKeys - Convert Keys to lowercase. Default:
false
.
See also ClaimTypes-constants.
- Troubleshooting Guide - See available NLog Targets and Layouts: https://nlog-project.org/config
- Getting started
- How to use structured logging
- Troubleshooting
- FAQ
- Articles about NLog
-
All targets, layouts and layout renderers
Popular: - Using NLog with NLog.config
- Using NLog with appsettings.json