예제 #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";
             * })*/
            ;
        }
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddMvc((options => options.EnableEndpointRouting = false));

            services.AddIdentityServer()
            .AddSigningCredential(GetIdServerCertificate())
            //.AddDeveloperSigningCredential()
            .AddInMemoryClients(ConfigureIdentityServer.GetClients())
            .AddInMemoryIdentityResources(ConfigureIdentityServer.GetIdentityResources())
            .AddProfileService <UserProfileService>();

            services.AddSingleton(sp =>
            {
                var config = TelemetryConfiguration.CreateDefault();

                config.DisableTelemetry = true;

                return(config);
            });

            services.AddSingleton <IUserStore, UserStore>();
            services.AddTransient <IPersistedGrantStore, PersistedGrantStore>();

            services.AddAuthentication()
            .AddGoogle("Google", options =>
            {
                options.SignInScheme = IdentityServerConstants.ExternalCookieAuthenticationScheme;
                options.ClientId     = "434483408261-55tc8n0cs4ff1fe21ea8df2o443v2iuc.apps.googleusercontent.com";
                options.ClientSecret = "3gcoTrEDPPJ0ukn_aYYT6PWo";
            });
        }
예제 #3
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";
            })
            ;
        }
예제 #4
0
        // 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.AddMvc();

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

            services.AddSingleton <IUserStore, UserStore>();
            services.AddTransient <IPersistedGrantStore, PersistedGrantStore>();

            services.AddAuthentication(options => { options.DefaultChallengeScheme = "Google"; })
            .AddGoogle("Google", options =>
            {
                options.SignInScheme = IdentityServerConstants.ExternalCookieAuthenticationScheme;
                options.ClientId     = "931441181996-mkjk82ok1m9a4eqde6tfkmpv8kqj7o4v.apps.googleusercontent.com";
                options.ClientSecret = "twubokDw9XV_91dnmS0TVUNT";
            });
        }