question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

PersonalData attribute is neglected by UserManager

See original GitHub issue

Describe the bug Hi, I have recently started using mongoDB. I have a class User : MongoUser<Guid> with some custom properties [BsonRequired] [PersonalData] public string FirstName { get; }

[BsonRequired] [PersonalData] public string LastName { get; }

When calling UserManager.FindByEmailAsync(email), the returned result for the User is setting my custom user data properties to NULL.

To Reproduce My Identity.Mongo configuration

`services.AddIdentityMongoDbProvider<User, MongoRole<Guid>, Guid>( options => { options.Password.RequireDigit = false; options.Password.RequireLowercase = false; options.Password.RequireNonAlphanumeric = false; options.Password.RequireUppercase = false; options.Password.RequiredLength = 1; options.Password.RequiredUniqueChars = 0;

                options.User.RequireUniqueEmail = true;

                options.Lockout.DefaultLockoutTimeSpan = TimeSpan.FromMinutes(1);
                options.Lockout.MaxFailedAccessAttempts = 5;
            },
            mongo =>
            {
                var databaseSettings = Configuration.GetSection(nameof(IdentityDatabaseSettings))
                    .Get<IdentityDatabaseSettings>();

                mongo.ConnectionString = databaseSettings.ConnectionString;
            });`

Expected behavior I am not entirely sure if this is bug or if I am missing something. Thanks.

Environment (please complete the following information):

  • .Net Core version: net5.0
  • Package Version: 8.3.1

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
vova3211commented, Oct 25, 2021

Hi @IvayloGugalov ! Will test it and let you know asap.

0reactions
novecentocommented, Jun 20, 2022

Are Firstname, Lastname really “encrypted” by PersonalData attribute? In my tests custom properties are untouched by ProtectPersonalData of AddIdentityMongoDbProvider.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Extending ASP.NET Core 2.2 Identity Management - Scott Kuhl
These properties are also marked with PersonalData, ... We also want to add or update or OnModelCreating to ignore the FullName property we...
Read more >
Add, download, and delete user data to Identity in an ASP. ...
Properties with the PersonalData attribute are: ... if (user == null) { return NotFound($"Unable to load user with ID '{_userManager.
Read more >
c# - What's the PersonalDataAttribute good for?
The ASP.NET Core Identity UI includes a "Download Personal Data" page, which uses the [PersonalData] attribute to help determine what to ...
Read more >
Audit Trail Implementation in ASP.NET Core with Entity ...
These are the properties and data that we are going to track with the implementation. It covers pretty much all the vital property...
Read more >
How to Manage the Protection of Personal Data in SAP ...
When running the wizard, Data Ownership is ignored; if a user is authorized to access a wizard action then they can access all...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found