// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.Configure <CookiePolicyOptions>(options => { // This lambda determines whether user consent for non-essential cookies is needed for a given request. options.CheckConsentNeeded = context => true; options.MinimumSameSitePolicy = SameSiteMode.None; }); services.AddDbContext <ChameleonStoreContext>(options => options.UseSqlServer( Configuration.GetConnectionString("ChameleonStore"))); services .AddIdentity <User, IdentityRole>() .AddDefaultUI() .AddDefaultTokenProviders() .AddEntityFrameworkStores <ChameleonStoreContext>(); services .AddAuthentication() .AddFacebook(options => { options.AppId = this.Configuration.GetSection("ExternalAuthentication:Facebook:AppId").Value; options.AppSecret = this.Configuration.GetSection("ExternalAuthentication:Facebook:AppSecret").Value; }) .AddGoogle(options => { options.ClientId = this.Configuration.GetSection("ExternalAuthentication:Google:ClientId").Value; options.ClientSecret = this.Configuration.GetSection("ExternalAuthentication:Google:ClientSecret").Value; }); services.Configure <IdentityOptions>(options => { options.Password = new PasswordOptions() { RequiredLength = 5, RequiredUniqueChars = 2, RequireLowercase = true, RequireDigit = true, RequireUppercase = true, RequireNonAlphanumeric = true }; options.SignIn.RequireConfirmedEmail = true; }); services.AddAutoMapper(); services.AddSession(); ServicesConfiguration.RegisterAll(services); services .AddMvc() .SetCompatibilityVersion(CompatibilityVersion.Version_2_1); }