Last active
July 9, 2020 07:20
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void ConfigureServices(IServiceCollection services) | |
{ | |
... | |
services.Configure<IdentityOptions>(options => | |
{ | |
// Password settings. | |
options.Password.RequireDigit = true; | |
options.Password.RequireLowercase = true; | |
options.Password.RequireNonAlphanumeric = true; | |
options.Password.RequireUppercase = true; | |
options.Password.RequiredLength = 6; | |
options.Password.RequiredUniqueChars = 1; | |
// Lockout settings. | |
options.Lockout.DefaultLockoutTimeSpan = TimeSpan.FromMinutes(5); | |
options.Lockout.MaxFailedAccessAttempts = 5; | |
options.Lockout.AllowedForNewUsers = true; | |
// User settings. | |
options.User.AllowedUserNameCharacters = | |
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._@+"; | |
options.User.RequireUniqueEmail = false; | |
}); | |
services.ConfigureApplicationCookie(options => | |
{ | |
// Cookie settings | |
options.Cookie.HttpOnly = true; | |
options.ExpireTimeSpan = TimeSpan.FromMinutes(5); | |
options.LoginPath = "/Identity/Account/Login"; | |
options.AccessDeniedPath = "/Identity/Account/AccessDenied"; | |
options.SlidingExpiration = true; | |
}); | |
... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment