AD Security login with UPN name

Hey everyone,
Setting up Login via AD and users that have a alternate UPN suffix. For example if the AD domain is "company.local" and the UPN suffix for the user is actual "company.com" logon fails when the user supplies there complete UPN name "username@company.com" but does work if they supply "username" only and even works if they supply "username@company.local" which is not there correct UPN name. Users have been trained to logon using their UPN logon name due to Office 365 so hoping they will be able to logon using the same format for there username.

Thanks for any help or advice.
Dave

I think this is something to ask the NET / ASP.NET Core Team of Microsoft since authentication is handled by Microsoft services in the background. Perhaps you could report your problem / proposal here: https://github.com/dotnet/aspnetcore/issues

Ok thanks, I will do that.

You can always modify the ApplicationUserManager.cs file per your requirements. Check the FindUser method. Also make sure to add that file to Radzen's code generation ignore list.

Thanks,

That worked.

I created this ...
private string LogonName
{
get
{
return options.User.Split('@').First();
}
}

And then changed this ...
public override Task FindByNameAsync(string userName)
{
//userName = userName.Replace($"@{this.Domain}", "");
userName = this.LogonName;
var result = this.FindUser(userName);

        if (result != null || userName == "admin")
        {
            return Task.FromResult(new ApplicationUser
            {
                UserName = userName
            });
        }

The only downside I could see would be if the users pre-windows 2000 sAMAccountName was different than their UPN logon name. Fortunately for us that is not true.

Dave

1 Like