I just stumbled over the fact that ASP.NET Core Identity framework offers a PersonalData attribute. The docs merely say:
Used to indicate that a something is considered personal data.
Okay. What does it mean? Does it have any implication on how the identity frameworks works or what it does? Or is it purely decorative, so that I can do some reflection on some objects and document my code?
ASP.NET Core applications access the HTTPContext through the IHttpContextAccessor interface. The HttpContextAccessor class implements it. You can use this class when you need to access HttpContext inside a service.
AddEntityFrameworkStores<TContext>(IdentityBuilder)Adds an Entity Framework implementation of identity information stores. C# Copy.
ASP.NET Core provides ASP.NET Core Identity as a Razor Class Library. Applications that include Identity can apply the scaffolder to selectively add the source code contained in the Identity Razor Class Library (RCL). You might want to generate source code so you can modify the code and change the behavior.
The ASP.NET Core Identity UI includes a "Download Personal Data" page, which uses the [PersonalData]
attribute to help determine what to include in the download (source):
// Only include personal data for download var personalData = new Dictionary<string, string>(); var personalDataProps = typeof(TUser).GetProperties().Where( prop => Attribute.IsDefined(prop, typeof(PersonalDataAttribute))); foreach (var p in personalDataProps) { personalData.Add(p.Name, p.GetValue(user)?.ToString() ?? "null"); }
There's also [ProtectedPersonalData]
, which inherits from [PersonalData]
. This attribute also configures Identity's EF Core integration to encrypt the property when it's stored in the database.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With