示例#1
0
文件: Startup.cs 项目: fabioper/forum
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddDbContext <AuthDbContext>(options =>
                                                  options.UseSqlServer(_configuration.GetConnectionString("AuthConnection")));

            services.AddIdentity <ApplicationUser, IdentityRole>(options => options.User.RequireUniqueEmail = true)
            .AddEntityFrameworkStores <AuthDbContext>()
            .AddDefaultTokenProviders();

            services.AddIdentityServer()
            .AddDeveloperSigningCredential()
            .AddInMemoryPersistedGrants()
            .AddInMemoryIdentityResources(IdentityServerConfig.GetIdentityResources())
            .AddInMemoryApiResources(IdentityServerConfig.GetApiResources())
            .AddInMemoryClients(IdentityServerConfig.GetClients())
            .AddAspNetIdentity <ApplicationUser>();

            services.AddControllersWithViews();
        }