Beispiel #1
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddControllersWithViews();

            var builder = services.AddIdentityServer()
                          .AddInMemoryClients(ConfigureIdentityServer.GetClients())
                          .AddInMemoryIdentityResources(ConfigureIdentityServer.GetIdentityResources())
                          .AddInMemoryApiScopes(ConfigureIdentityServer.ApiScopes())
                          .AddInMemoryApiResources(ConfigureIdentityServer.GetApiResources())
                          .AddProfileService <UserProfileService>();

            builder.AddDeveloperSigningCredential();

            services.AddSingleton <IUserStore, UserStore>();

            services.AddTransient <IPersistedGrantStore, PersistedGrantStore>();

            services.AddAuthentication()
            .AddFacebook("Facebook", options =>
            {
                options.SignInScheme = IdentityServerConstants.ExternalCookieAuthenticationScheme;

                options.AppId     = Configuration["Authentication:Facebook:AppId"];
                options.AppSecret = Configuration["Authentication:Facebook:AppSecret"];
            })

            /*.AddGoogle("Google", options =>
             * {
             *  options.SignInScheme = IdentityServerConstants.ExternalCookieAuthenticationScheme;
             *  options.ClientId = "434483408261-55tc8n0cs4ff1fe21ea8df2o443v2iuc.apps.googleusercontent.com";
             *  options.ClientSecret = "3gcoTrEDPPJ0ukn_aYYT6PWo";
             * })*/
            ;
        }