I have a custom IClaimsTransformation
thanks to @jim-karnopp. All appears to work fine aside from when I try to add a user to the database that doesn't already exist.
var user = identity.Name
AppUser newuser = new AppUser()
{
UserName = user,
EmailConfirmed = false,
PhoneNumberConfirmed = false,
TwoFactorEnabled = false,
LockoutEnabled = false,
AccessFailedCount = 0
};
var createUser = await _userManager.CreateAsync(newuser);
Is there a better way to add a windows authenticated user to the identity database? I'm receiving a 'InvalidUserName' "can only contain letters and digits" error currently. Because identity.name
equals DOMAIN\\username
Is there a way to store the windows authenticated username in the identity db?
Thank you
Configure the username validator to allow .
services.AddIdentity<ApplicationUser, IdentityRole>(options => {
options.User.AllowedUserNameCharacters = "allowed characters here";
});