Skip to content

Commit

Permalink
Copied across the from cdms for the sensitive data, so it uses the js…
Browse files Browse the repository at this point in the history
…on property name attribute
  • Loading branch information
Thomas Anderson committed Dec 5, 2024
1 parent 7ece879 commit d2babf4
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion Btms.SensitiveData/SensitiveFieldsProvider.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System.Reflection;
using System.Text.Json;
using System.Text.Json.Serialization;

namespace Btms.SensitiveData;

Expand Down Expand Up @@ -49,8 +50,10 @@ private static List<string> GetSensitiveFields(string root, Type type)
var list = new List<string>();
foreach (var property in type.GetProperties())
{
var jsonPropertyNameAttribute = property.GetCustomAttribute<JsonPropertyNameAttribute>();
var propertyName = jsonPropertyNameAttribute != null ? jsonPropertyNameAttribute.Name : property.Name;
string currentPath;
currentPath = string.IsNullOrEmpty(root) ? $"{namingPolicy.ConvertName(property.Name)}" : $"{namingPolicy.ConvertName(root)}.{namingPolicy.ConvertName(property.Name)}";
currentPath = string.IsNullOrEmpty(root) ? $"{namingPolicy.ConvertName(propertyName)}" : $"{namingPolicy.ConvertName(root)}.{namingPolicy.ConvertName(propertyName)}";

if (property.CustomAttributes.Any(x => x.AttributeType == typeof(SensitiveDataAttribute)))
{
Expand Down

0 comments on commit d2babf4

Please sign in to comment.