fix(auth): configure Identity cookie paths to use custom login page
Add ConfigureApplicationCookie to override Identity default paths (/Account/Login) with custom paths (/login). This fixes the 404 error when unauthenticated users are redirected to the login page.
This commit is contained in:
1 parent
364e8e6f55
commit
e5fb13632f
1 file changed
+8
@@ -55,6 +55,14 @@ public static class DependencyInjection
|
||||
.AddEntityFrameworkStores<AppDbContext>()
|
||||
.AddDefaultTokenProviders();
|
||||
|
||||
// Configure Identity cookie paths to use custom login page instead of default /Account/Login
|
||||
services.ConfigureApplicationCookie(options =>
|
||||
{
|
||||
options.LoginPath = "/login";
|
||||
options.LogoutPath = "/_auth/signout";
|
||||
options.AccessDeniedPath = "/not-found";
|
||||
});
|
||||
|
||||
// Data Protection (for camera credential encryption)
|
||||
var dpMode = configuration.GetValue<string>("DataProtection:Mode") ?? "Persisted";
|
||||
if (dpMode == "Ephemeral")
|
||||
|
||||
Reference in new issue
Block a user