What is the best practice for supporting user account registration and sign-in for website (customer) users and also supporting a cms user accounts / admin logins using separate user identity service for both site and cms in the same project?
In order to evaluate how this scenario might work i have have built a test mvc .net core 3.1 website project that utilizes Piranha CMS which in turn uses the user identity service to manage authentication for access to the cms admin panel, couple this with the mvc site also supporting user identity for individual accounts for website customer/users to register/ sign-in.
The following is an example of the startup class ConfigureServices method to illustrate setup of both a cms and website using the user identity service, this currently errors on startup with a message - System.InvalidOperationException: 'Scheme already exists: Identity.Application'
// CMS Setup
services.AddPiranha(options =>
{
options.UseFileStorage();
options.UseImageSharp();
options.UseManager();
options.UseTinyMCE();
options.UseMemoryCache();
options.UseEF<SQLServerDb>(db => db.UseSqlServer(Configuration.GetConnectionString("db-cms-users")));
options.UseIdentityWithSeed<IdentitySQLServerDb>(db => db.UseSqlServer(Configuration.GetConnectionString("db-cms-users")));
});
// Site Setup
services.AddDbContext<ApplicationDbContext>(options => options.UseSqlServer(Configuration.GetConnectionString("db-site-users")));
services.AddDefaultIdentity<IdentityUser>(options => options.SignIn.RequireConfirmedAccount = true).AddEntityFrameworkStores<ApplicationDbContext>();
The problem with the above code the fact that user identity is used by both the cms and the site, and this conflicts due to the 'default' identity being used for both, is there a way around this issue and still support both the cms and the website for user/accounts.
So my question is both of these together in the same project appear not play nice, and i would like to know in this scenario what the best practice would be to support a web project utilizing both a cms and site both supported with user identity and/or if this is even at all possible in this context?