Beispiel #1
0
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddMvc();

            services.AddIdentityServer()
            .AddDeveloperSigningCredential()
            .AddProfileService <UserProfileService>()
            .AddInMemoryClients(ConfigureIdentityServer.GetClients())
            .AddInMemoryIdentityResources(ConfigureIdentityServer.GetIdentityResources())
            .AddInMemoryApiResources(ConfigureIdentityServer.GetApis())
            ;

            services.AddSingleton <IUserStore, UserStore>(
                s => new UserStore(Configuration.GetConnectionString("ObukaDB"))
                );

            services.AddTransient <IPersistedGrantStore, PersistedGrantStore>(
                s => new PersistedGrantStore(Configuration.GetConnectionString("ObukaDB"))
                );

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