// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { // Add framework services. services.AddEntityFramework(Configuration.GetConnectionString("DefaultConnection")); services.AddIdentity(); services.AddMvc(); // Add application services. services.AddTransient <IEmailSender, AuthMessageSender>(); services.AddTransient <ISmsSender, AuthMessageSender>(); // Add IdentityServer services services.AddSingleton <IClientStore, CustomClientStore>(); //services.AddScoped<SignInManager<BiffUser>, SignInManager<BiffUser>>(); services.AddIdentityServer() .AddTemporarySigningCredential() // Can be used for testing until a real cert is available //.AddSigningCredential(new X509Certificate2(Path.Combine(".", "certs", "IdentityServer4Auth.pfx"))) .AddInMemoryApiResources(MyApiResourceProvider.GetAllResources()) .AddInMemoryIdentityResources(MyApiResourceProvider.GetIdentityResources()) .AddAspNetIdentity <BiffUser>(); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { // Add framework services. services.AddDbContext <ApplicationDbContext>(options => options.UseSqlServer(Configuration.GetConnectionString("DefaultConnection"))); services.AddIdentity <ApplicationUser, IdentityRole>() .AddEntityFrameworkStores <ApplicationDbContext>() .AddDefaultTokenProviders(); services.AddMvc(); // Add application services. services.AddTransient <IEmailSender, AuthMessageSender>(); services.AddTransient <ISmsSender, AuthMessageSender>(); // Add IdentityServer services services.AddSingleton <IClientStore, CustomClientStore>(); services.AddIdentityServer() // .AddTemporarySigningCredential() // Can be used for testing until a real cert is available .AddSigningCredential(new X509Certificate2(Path.Combine(".", "certs", "IdentityServer4Auth.pfx"))) .AddInMemoryApiResources(MyApiResourceProvider.GetAllResources()) .AddAspNetIdentity <ApplicationUser>(); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { // Add framework services. services.AddDbContext <ApplicationDbContext>(options => options.UseSqlite(Configuration.GetConnectionString("DefaultConnection"))); services.AddIdentity <ApplicationUser, IdentityRole>() .AddEntityFrameworkStores <ApplicationDbContext>() .AddDefaultTokenProviders(); services.AddMvc(); //if (_env.IsDevelopment()) { //for development services.AddIdentityServer() .AddTemporarySigningCredential() .AddInMemoryApiResources(MyApiResourceProvider.GetAllResources()) .AddAspNetIdentity <ApplicationUser>(); } // else // { // //TODO; Production environment, should load from certificate store instead //services.AddIdentityServer() // .AddSigningCredential(new X509Certificate2("CertPath", "SomePassword")); //} // Add IdentityServer services services.AddSingleton <IClientStore, CustomClientStore>(); // Add application services. services.AddTransient <IEmailSender, AuthMessageSender>(); services.AddTransient <ISmsSender, AuthMessageSender>(); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { // Add framework services. services.AddMvc(); services.AddIdentityServer() //for Identity server 4 authentication // .AddTemporarySigningCredential() // Can be used for testing until a real cert is available .AddSigningCredential(new X509Certificate2(Path.Combine(".", "certs", "IdentityServer4Auth.pfx"))) .AddInMemoryApiResources(MyApiResourceProvider.GetAllResources()); }