We have factored out the code needed to implement Microsoft ASP.NET Core Identity security to Web APIs and applications (Blazor, Razor, MVC etc). This code implements a custom UserStore and custom RoleStore to manage access to a customised Identity data store (on SQL Server). Details of this customisation are here.
builder.Services.AddIdentity<UserCredential, AssignedUserRole>(
    options =>
    {
        options.Password.RequireLowercase = true;
        options.Password.RequireUppercase = true;
        options.Password.RequireDigit = true;
        options.Password.RequireNonAlphanumeric = true;
        options.Password.RequiredLength = 8;
    })
    .AddDefaultTokenProviders();
The classes UserCredential and AssignedUserRole are part of the Identity object model.
