PersonalData attribute is neglected by UserManager
See original GitHub issueDescribe 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:
- Created 2 years ago
- Comments:6 (1 by maintainers)

Top Related StackOverflow Question
Hi @IvayloGugalov ! Will test it and let you know asap.
Are Firstname, Lastname really “encrypted” by PersonalData attribute? In my tests custom properties are untouched by ProtectPersonalData of AddIdentityMongoDbProvider.