-
-
Save manoj-choudhari-git/9859999a22e0b66b855ecef96ba7a124 to your computer and use it in GitHub Desktop.
Startup Configuration - Adding Authentication Middleware
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.AddDbContext<ApplicationDbContext>(options => | |
options.UseSqlServer(Configuration.GetConnectionString("SqlConnection"))); | |
services.AddIdentity<IdentityUser, IdentityRole>(options => options.SignIn.RequireConfirmedAccount = true) | |
.AddEntityFrameworkStores<ApplicationDbContext>(); | |
services.AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme) | |
.AddCookie(CookieAuthenticationDefaults.AuthenticationScheme, options => | |
{ | |
options.SlidingExpiration = true; | |
options.ExpireTimeSpan = new TimeSpan(0, 1, 0); | |
}); | |
services.AddControllers(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment