コード例 #1
0
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddIdentity(Configuration);

            var assembly = GetType().Assembly.GetName().Name;

            services.AddIdentityServer()
            .AddAspNetIdentity <IdentityUser>()
            //.AddConfigurationStore(opts =>
            //{
            //    opts.ConfigureDbContext = x => x.UseSqlite(Configuration["Database:ConnectionString"],
            //        sql => sql.MigrationsAssembly(assembly));
            //})
            //.AddOperationalStore(options =>
            //{
            //    options.ConfigureDbContext = x => x.UseSqlite(Configuration["Database:ConnectionString"],
            //        sql => sql.MigrationsAssembly(assembly));
            //})
            .AddInMemoryIdentityResources(IdentityConfiguration.GetIdentityResources())
            .AddInMemoryApiResources(IdentityConfiguration.GetApis())
            .AddInMemoryApiScopes(IdentityConfiguration.GetScopes())
            .AddInMemoryClients(IdentityConfiguration.GetClients())
            .AddDeveloperSigningCredential();

            services.AddAuthentication()
            .AddFacebook(opts =>
            {
                opts.AppId     = "???"; // your facebook apllication id
                opts.AppSecret = "???"; // your facebook application secret
            });

            services.AddControllersWithViews();
        }
コード例 #2
0
ファイル: Startup.cs プロジェクト: ojji/WebSocketDemo
 // This method gets called by the runtime. Use this method to add services to the container.
 // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
 public void ConfigureServices(IServiceCollection services)
 {
     services.AddIdentityServer()
     .AddTemporarySigningCredential()
     .AddInMemoryApiResources(IdentityConfiguration.GetResources())
     .AddInMemoryIdentityResources(IdentityConfiguration.GetIdentityResources())
     .AddInMemoryClients(IdentityConfiguration.GetClients())
     .AddTestUsers(IdentityConfiguration.GetTestUsers());
     services.AddMvc();
 }