Skip to content

Commit 5b2fa03

Browse files
committed
- Audit.WebApi: IncludeRequestBody to control Form Variables (#792)
- Audit.NET.MongoDB/Audit.MongoClient: Upgrading MongoDB.Driver (#793)
1 parent caad682 commit 5b2fa03

14 files changed

Lines changed: 142 additions & 50 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ All notable changes to Audit.NET and its extensions will be documented in this f
33

44
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
55

6+
## [32.2.0] - 2026-06-12:
7+
- **Audit.WebApi** / **Audit.WebApi.Core**: Making the existing `IncludeRequestBody` setting to control whether Form Variables are included (#792)
8+
- **Audit.NET.MongoDB** / **Audit.MongoClient**: Upgrading MongoDB.Driver to latest version 3.9.0 (#793)
9+
610
## [32.1.1] - 2026-05-31:
711
- **Audit.NET**: Update the AuditEvent.Target.Type when the audit event ends (#791)
812

Directory.Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<Project>
22
<PropertyGroup>
3-
<Version>32.1.1</Version>
3+
<Version>32.2.0</Version>
44
<PackageReleaseNotes></PackageReleaseNotes>
55
<CheckEolTargetFramework>false</CheckEolTargetFramework>
66
<LangVersion>latest</LangVersion>

src/Audit.MongoClient/Audit.MongoClient.csproj

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
33
<Description>Generate detailed Audit Logs for operations executed within MongoDB.</Description>
4-
<Copyright>Copyright 2023</Copyright>
4+
<Copyright>Copyright 2026</Copyright>
55
<AssemblyTitle>Audit.MongoClient</AssemblyTitle>
66
<Authors>Federico Colombo</Authors>
7-
<TargetFrameworks>net472;netstandard2.0;netstandard2.1;net6.0</TargetFrameworks>
7+
<TargetFrameworks>net472;netstandard2.1;net6.0</TargetFrameworks>
88
<DefineConstants>$(DefineConstants);STRONG_NAME</DefineConstants>
99
<NoWarn>$(NoWarn);1591</NoWarn>
1010
<GenerateDocumentationFile>true</GenerateDocumentationFile>
@@ -27,12 +27,8 @@
2727
<None Include="README.md" Pack="true" PackagePath="\" />
2828
</ItemGroup>
2929

30-
<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' ">
31-
<PackageReference Include="MongoDB.Driver" Version="2.30.0" />
32-
</ItemGroup>
33-
34-
<ItemGroup Condition=" '$(TargetFramework)' == 'net472' OR '$(TargetFramework)' == 'netstandard2.1' OR '$(TargetFramework)' == 'net6.0' ">
35-
<PackageReference Include="MongoDB.Driver" Version="3.1.0" />
30+
<ItemGroup>
31+
<PackageReference Include="MongoDB.Driver" Version="3.9.0" />
3632
</ItemGroup>
3733

3834
<ItemGroup Condition=" '$(TargetFramework)' != 'net6.0' ">

src/Audit.NET.MongoDB/Audit.NET.MongoDB.csproj

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
<PropertyGroup>
44
<Description>Store Audit.NET Trail Logs into a MongoDB database</Description>
5-
<Copyright>Copyright 2016</Copyright>
5+
<Copyright>Copyright 2026</Copyright>
66
<AssemblyTitle>Audit.MongoDB</AssemblyTitle>
77
<Authors>Federico Colombo</Authors>
8-
<TargetFrameworks>net462;net472;netstandard2.0;netstandard2.1;net6.0</TargetFrameworks>
8+
<TargetFrameworks>net472;netstandard2.1;net6.0</TargetFrameworks>
99
<NoWarn>$(NoWarn);1591;NU1903</NoWarn>
1010
<GenerateDocumentationFile>true</GenerateDocumentationFile>
1111
<AssemblyName>Audit.NET.MongoDB</AssemblyName>
@@ -27,26 +27,14 @@
2727
<None Include="README.md" Pack="true" PackagePath="\"/>
2828
</ItemGroup>
2929

30-
<ItemGroup Condition=" '$(TargetFramework)' == 'net462' ">
31-
<PackageReference Include="MongoDB.Driver" Version="2.13.3" />
32-
</ItemGroup>
33-
34-
<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' ">
35-
<PackageReference Include="MongoDB.Driver" Version="2.30.0" />
36-
</ItemGroup>
37-
38-
<ItemGroup Condition=" '$(TargetFramework)' == 'net472' OR '$(TargetFramework)' == 'netstandard2.1' OR '$(TargetFramework)' == 'net6.0' ">
39-
<PackageReference Include="MongoDB.Driver" Version="3.2.1" />
30+
<ItemGroup>
31+
<PackageReference Include="MongoDB.Driver" Version="3.9.0" />
4032
</ItemGroup>
4133

4234
<ItemGroup>
4335
<ProjectReference Include="..\Audit.NET\Audit.NET.csproj" />
4436
</ItemGroup>
4537

46-
<ItemGroup Condition=" '$(TargetFramework)' == 'net462' ">
47-
<Reference Include="Microsoft.CSharp" />
48-
</ItemGroup>
49-
5038
<ItemGroup>
5139
<None Include="images\icon.png" Pack="true" PackagePath="\"/>
5240
</ItemGroup>

src/Audit.NET.MongoDB/Providers/MongoDataProvider.cs

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -36,30 +36,18 @@ private static void ConfigureBsonMapping()
3636
};
3737
ConventionRegistry.Register("Ignore null properties for AuditEvent", pack, type => type == typeof(AuditEvent));
3838

39-
#if NET462
40-
BsonClassMap.RegisterClassMap<AuditTarget>(cm =>
41-
#else
4239
BsonClassMap.TryRegisterClassMap<AuditTarget>(cm =>
43-
#endif
4440
{
4541
cm.AutoMap();
4642
});
4743

48-
#if NET462
49-
BsonClassMap.RegisterClassMap<AuditEvent>(cm =>
50-
#else
5144
BsonClassMap.TryRegisterClassMap<AuditEvent>(cm =>
52-
#endif
5345
{
5446
cm.AutoMap();
5547
cm.MapExtraElementsField(c => c.CustomFields);
5648
});
5749

58-
#if NET462
59-
BsonClassMap.RegisterClassMap<AuditEventEnvironment>(cm =>
60-
#else
6150
BsonClassMap.TryRegisterClassMap<AuditEventEnvironment>(cm =>
62-
#endif
6351
{
6452
cm.AutoMap();
6553
cm.MapExtraElementsField(c => c.CustomFields);

src/Audit.WebApi/AuditApiAdapter.Core.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ private async Task<AuditApiAction> CreateOrUpdateAction(ActionExecutingContext a
109109
UserName = httpContext.User?.Identity.Name,
110110
IpAddress = httpContext.Connection?.RemoteIpAddress?.ToString(),
111111
HttpMethod = httpContext.Request.Method,
112-
FormVariables = await AuditApiHelper.GetFormVariables(httpContext, cancellationToken),
112+
FormVariables = includeRequestBody ? await AuditApiHelper.GetFormVariables(httpContext, cancellationToken) : null,
113113
TraceId = httpContext.TraceIdentifier,
114114
};
115115
}

src/Audit.WebApi/AuditApiAdapter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,11 @@ public async Task BeforeExecutingAsync(HttpActionContext actionContext, IContext
4949
IpAddress = contextWrapper.GetClientIp(),
5050
RequestUrl = request.RequestUri?.AbsoluteUri,
5151
HttpMethod = actionContext.Request.Method?.Method,
52-
FormVariables = contextWrapper.GetFormVariables(),
5352
Headers = includeHeaders ? ToDictionary(request.Headers) : null,
5453
ActionName = actionContext.ActionDescriptor?.ActionName,
5554
ControllerName = actionContext.ActionDescriptor?.ControllerDescriptor?.ControllerName,
5655
ActionParameters = GetActionParameters(actionContext.ActionDescriptor, actionContext.ActionArguments, serializeParams),
56+
FormVariables = includeRequestBody ? contextWrapper.GetFormVariables() : null,
5757
RequestBody = includeRequestBody ? GetRequestBody(contextWrapper) : null,
5858
TraceId = request.GetCorrelationId().ToString(),
5959
HttpActionContext = actionContext

src/Audit.WebApi/AuditMiddleware.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ private async Task BeforeInvoke(HttpContext context, bool includeHeaders, bool i
102102
IpAddress = context.Connection?.RemoteIpAddress?.ToString(),
103103
RequestUrl = context.Request.GetDisplayUrl(),
104104
HttpMethod = context.Request.Method,
105-
FormVariables = await AuditApiHelper.GetFormVariables(context, cancellationToken),
105+
FormVariables = includeRequestBody ? await AuditApiHelper.GetFormVariables(context, cancellationToken) : null,
106106
Headers = includeHeaders ? AuditApiHelper.ToDictionary(context.Request.Headers) : null,
107107
ActionName = null,
108108
ControllerName = null,

test/Audit.MongoClient.UnitTest/Audit.MongoClient.UnitTest.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFrameworks>net472;netcoreapp3.1;net8.0</TargetFrameworks>
4+
<TargetFrameworks>net472;netcoreapp3.1;net6.0</TargetFrameworks>
55
<IsPackable>false</IsPackable>
66
<IsTestProject>true</IsTestProject>
77
<DebugType>Full</DebugType>

test/Audit.MongoDB.UnitTest/Audit.MongoDB.UnitTest.csproj

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFrameworks>net462;net472;netcoreapp3.1;net6.0</TargetFrameworks>
4+
<TargetFrameworks>net472;netcoreapp3.1;net6.0</TargetFrameworks>
55
<NoWarn>$(NoWarn);1591;NETSDK1138</NoWarn>
66
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
77
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
@@ -21,8 +21,4 @@
2121
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
2222
</ItemGroup>
2323

24-
<ItemGroup Condition=" '$(TargetFramework)' == 'net462' ">
25-
<Reference Include="Microsoft.CSharp" />
26-
</ItemGroup>
27-
2824
</Project>

0 commit comments

Comments
 (0)