Skip to content

Instantly share code, notes, and snippets.

@vaygeth89
Last active November 17, 2020 20:43
Show Gist options
  • Save vaygeth89/994615e41900e8d8bf6c5b98365675ba to your computer and use it in GitHub Desktop.
Save vaygeth89/994615e41900e8d8bf6c5b98365675ba to your computer and use it in GitHub Desktop.
tutorial-dotnet-JWTProtectedAPI ConfigureServices()
//rest of Startup.cs code
public void ConfigureServices(IServiceCollection services)
{
services.AddControllers();
services.AddDbContext<AppDbContext>(options => options.UseSqlServer(Configuration.GetConnectionString("SqlServerDb")));
services.AddIdentity<IdentityUser, IdentityRole>(options =>
{
//! Change your security Policy here to suits your policy
options.Password.RequireUppercase = false;
options.Password.RequireDigit = false;
//! tutorial purposes im allowed users to sign in without their email confirmation
options.SignIn.RequireConfirmedEmail = false;
}).AddEntityFrameworkStores<AppDbContext>().AddDefaultTokenProviders();
setUpBearerJwtAuth(services);
}
//rest of Startup.cs code
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment