Describe the bug
[AuditApi(IncludeRequestBody = false] doesn't ignore FormVariables
To Reproduce
Given this endpoint
[AllowAnonymous]
[HttpPost("~/connect/token")]
[Consumes("application/x-www-form-urlencoded")]
[Produces("application/json")]
[AuditApi(IncludeRequestBody = false, IncludeResponseBody = false)]
public async Task<IActionResult> Exchange()
{
var request = HttpContext.GetOpenIddictServerRequest();
// ...
}
and this request
POST /connect/token
Content-Type: application/x-www-form-urlencoded
Accept: application/json
grant_type=client_credentials&client_id=CLIENT_ID&client_secret=SECRET
I'm seeing this in the log
Expected behavior
I was expecting IncludeRequestBody = false to remove the form-urlencoded body and not show FormVariables.
Strangely IncludeRequestBody = true only logs
I was expecting something like
Libraries (specify the Audit.NET extensions being used including version):
- Audit.WebApi.Core: 32.1.1
Target .NET framework:
Describe the bug
[AuditApi(IncludeRequestBody = false]doesn't ignore FormVariablesTo Reproduce
Given this endpoint
and this request
I'm seeing this in the log
{ "Action": { "HttpMethod": "POST", "ActionName": "Exchange", "ActionParameters": {}, "FormVariables": { "grant_type": "client_credentials", "client_id": "CLIENT_ID", "client_secret": "SECRET" }, "ResponseStatus": "OK", "ResponseStatusCode": 200, "RequestBody": { "Type": "application/x-www-form-urlencoded", "Length": 151 } }, // rest omitted }Expected behavior
I was expecting
IncludeRequestBody = falseto remove theform-urlencodedbody and not showFormVariables.Strangely
IncludeRequestBody = trueonly logsI was expecting something like
Libraries (specify the Audit.NET extensions being used including version):
Target .NET framework: