'userStore.FindByNameAsync and IPersonalDataProtector

So I am halfway there.... ;-) I have my data protection attributes working using entity framework core 6.4 with "my application user"

services.AddScoped<IUserStore<ApplicationUser>, UserOnlyStore<ApplicationUser, UserDataContext, int>>();
services.AddScoped<ILookupProtectorKeyRing, KeyRing>();
services.AddScoped<ILookupProtector, LookupProtector>();
services.AddScoped<IPersonalDataProtector, PersonalDataProtector>();

I can create the bellow user using the

var result = await userManager.CreateAsync(user, "some pw 1234")

Data in the database

However when I call

 var clone= await userStore.FindByNameAsync(_email, CancellationToken.None);

it never uses the IPersonalDataProtector and it then doesn't find the user as the cypher data isn't matching the uncyphered data as shown in the sql trace... query the user

What configuration am I missing, why store encrypted if it, doesn't query the data using a compatible method?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source