当前位置: 首页>>代码示例>>C#>>正文


C# IApplicationBuilder.UseIdentityServer方法代码示例

本文整理汇总了C#中IApplicationBuilder.UseIdentityServer方法的典型用法代码示例。如果您正苦于以下问题:C# IApplicationBuilder.UseIdentityServer方法的具体用法?C# IApplicationBuilder.UseIdentityServer怎么用?C# IApplicationBuilder.UseIdentityServer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IApplicationBuilder的用法示例。


在下文中一共展示了IApplicationBuilder.UseIdentityServer方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Configure

        public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
        {
            loggerFactory.AddConsole(Configuration.GetSection("Logging"));
            loggerFactory.AddDebug();

            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
                app.UseDatabaseErrorPage();
                // Does not work with HTTPS
                //app.UseBrowserLink();
            }
            else
            {
                app.UseExceptionHandler("/Home/Error");
            }

            app.UseStaticFiles();

            app.UseIdentity();
            app.UseIdentityServer();

            app.UseMvc(routes =>
            {
                routes.MapRoute(
                    name: "default",
                    template: "{controller=Home}/{action=Index}/{id?}");
            });
        }
开发者ID:damienbod,项目名称:AspNet5IdentityServerAngularImplicitFlow,代码行数:29,代码来源:Startup.cs

示例2: Configure

        public void Configure(IApplicationBuilder app, IApplicationEnvironment env, ILoggerFactory loggerFactory)
        {
            Log.Logger = new LoggerConfiguration()
                .MinimumLevel.Debug()
                .WriteTo.LiterateConsole()
                .CreateLogger();

            loggerFactory.AddConsole();
            loggerFactory.AddDebug();

            app.UseIISPlatformHandler();
            

            var certFile = env.ApplicationBasePath + $"{System.IO.Path.DirectorySeparatorChar}idsrv3test.pfx";

            var idsrvOptions = new IdentityServerOptions
            {
                Factory = new IdentityServerServiceFactory()
                                .UseInMemoryUsers(Users.Get())
                                .UseInMemoryClients(Clients.Get())
                                .UseInMemoryScopes(Scopes.Get()),

                SigningCertificate = new X509Certificate2(certFile, "idsrv3test"),
                RequireSsl = false
            };

            app.UseIdentityServer(idsrvOptions);
        }
开发者ID:RobGibbens,项目名称:IdentityServer3.Samples,代码行数:28,代码来源:Startup.cs

示例3: Configure

        public void Configure(IApplicationBuilder app, ILoggerFactory loggerFactory)
        {
            loggerFactory.AddConsole(LogLevel.Trace);
            loggerFactory.AddDebug(LogLevel.Trace);

            app.UseDeveloperExceptionPage();

            app.UseCookieAuthentication(new CookieAuthenticationOptions
            {
                AuthenticationScheme = "Temp",
                AutomaticAuthenticate = false,
                AutomaticChallenge = false
            });

            app.UseGoogleAuthentication(new GoogleOptions
            {
                AuthenticationScheme = "Google",
                SignInScheme = "Temp",
                ClientId = "434483408261-55tc8n0cs4ff1fe21ea8df2o443v2iuc.apps.googleusercontent.com",
                ClientSecret = "3gcoTrEDPPJ0ukn_aYYT6PWo"
            });

            app.UseIdentityServer();

            app.UseStaticFiles();
            app.UseMvcWithDefaultRoute();
        }
开发者ID:wondertrap,项目名称:AspNet5IdentityServerAngularImplicitFlow,代码行数:27,代码来源:Startup.cs

示例4: Configure

        public void Configure(IApplicationBuilder app, IApplicationEnvironment env)
        {
          
            app.UseIISPlatformHandler();
            app.UseDeveloperExceptionPage();

            app.UseIdentity();

            var certFile = env.ApplicationBasePath + "\\damienbodserver.pfx";

            var idsrvOptions = new IdentityServerOptions
            {
                Factory = new IdentityServerServiceFactory()
                                .UseInMemoryUsers(Users.Get())
                                .UseInMemoryClients(Clients.Get())
                                .UseInMemoryScopes(Scopes.Get()),

                SigningCertificate = new X509Certificate2(certFile, ""),
                AuthenticationOptions = new AuthenticationOptions
                {
                    EnablePostSignOutAutoRedirect = true
                }
            };

            app.UseIdentityServer(idsrvOptions);
        }
开发者ID:firehang,项目名称:AspNet5IdentityServerAngularImplicitFlow,代码行数:26,代码来源:Startup.cs

示例5: Configure

        public void Configure(IApplicationBuilder app, ILoggerFactory loggerFactory)
        {
            loggerFactory.AddConsole(LogLevel.Verbose);
            loggerFactory.AddDebug(LogLevel.Verbose);

            app.UseDeveloperExceptionPage();
            app.UseIISPlatformHandler();

            app.UseIdentityServer();

            app.UseCookieAuthentication(options =>
            {
                options.AuthenticationScheme = "External";
            });

            app.UseGoogleAuthentication(options =>
            {
                options.AuthenticationScheme = "Google";
                options.SignInScheme = "External";

                options.ClientId = Configuration["GoogleIdentityProvider:ClientId"];
                options.ClientSecret = Configuration["GoogleIdentityProvider:ClientSecret"];
                options.CallbackPath = new PathString("/googlecallback");                
            });

            app.UseStaticFiles();
            app.UseMvcWithDefaultRoute();
        }
开发者ID:pikoscielniak,项目名称:notifier,代码行数:28,代码来源:Startup.cs

示例6: Configure

 public void Configure(IApplicationBuilder app, ILoggerFactory loggerFactory)
 {
     loggerFactory.AddConsole(LogLevel.Verbose);
     loggerFactory.AddDebug(LogLevel.Verbose);
     app.UseStaticFiles();
     app.UseIdentityServer();
 }
开发者ID:gerry123,项目名称:g42,代码行数:7,代码来源:Startup.cs

示例7: Configure

        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IApplicationEnvironment env)
        {
            app.UseIISPlatformHandler();
            app.UseDeveloperExceptionPage();
            app.UseCors("corsGlobalPolicy");
            var certFile = env.ApplicationBasePath + "\\cert.pfx";

            var idsrvOptions = new IdentityServerOptions
            {
                Factory = new IdentityServerServiceFactory()
                                .UseInMemoryUsers(Users.Get())
                                .UseInMemoryClients(Clients.Get())
                                .UseInMemoryScopes(Scopes.Get()),

                SigningCertificate = new X509Certificate2(certFile, "christus"),
                AuthenticationOptions = new AuthenticationOptions
                {
                    EnablePostSignOutAutoRedirect = true
                },
                LoggingOptions = new LoggingOptions
                {
                    EnableHttpLogging = true,
                    EnableWebApiDiagnostics = true,
                    WebApiDiagnosticsIsVerbose = true
                 
                },
                

            };

            app.UseIdentityServer(idsrvOptions);
        }
开发者ID:tadmcclellan,项目名称:WebAPI,代码行数:33,代码来源:Startup.cs

示例8: Configure

        public void Configure(IApplicationBuilder app, IApplicationEnvironment env)
        {
            app.UseIISPlatformHandler();
            app.UseDeveloperExceptionPage();

            app.UseIdentity();

            app.UseIdentityServer();
        }
开发者ID:pugillum,项目名称:AspNet5IdentityServerAngularImplicitFlow,代码行数:9,代码来源:Startup.cs

示例9: Configure

        public void Configure(IApplicationBuilder app)
        {
            var idsrvOptions = new IdentityServerOptions
            {
                Factory = new IdentityServerServiceFactory()
                                .UseInMemoryUsers(Users.Get())
                                .UseInMemoryClients(Clients.Get())
                                .UseInMemoryScopes(Scopes.Get()),
            };

            app.UseIdentityServer(idsrvOptions);
        }
开发者ID:MichaelPetrinolis,项目名称:IdentityServer3.Samples,代码行数:12,代码来源:Startup.cs

示例10: Configure

        public void Configure(IApplicationBuilder app, ILoggerFactory loggerFactory)
        {
            loggerFactory.AddConsole(LogLevel.Verbose);
            loggerFactory.AddDebug(LogLevel.Verbose);

            app.UseDeveloperExceptionPage();
            app.UseIISPlatformHandler();

            app.UseIdentityServer();

            app.UseStaticFiles();
            app.UseMvcWithDefaultRoute();
        }
开发者ID:jvanrhyn,项目名称:IdentityServer4.Samples,代码行数:13,代码来源:Startup.cs

示例11: Configure

        public void Configure(IApplicationBuilder app, IApplicationEnvironment env)
        {
            var certFile = env.ApplicationBasePath + "\\idsrv3test.pfx";

            var idsrvOptions = new IdentityServerOptions
            {
                Factory = new IdentityServerServiceFactory()
                                .UseInMemoryUsers(Users.Get())
                                .UseInMemoryClients(Clients.Get())
                                .UseInMemoryScopes(Scopes.Get()),

                SigningCertificate = new X509Certificate2(certFile, "idsrv3test")
            };

            app.UseIdentityServer(idsrvOptions);
        }
开发者ID:narzul1,项目名称:IdentityServer3.Samples,代码行数:16,代码来源:Startup.cs

示例12: Configure

        public void Configure(IApplicationBuilder app, IApplicationEnvironment env)
        {
            app.UseIISPlatformHandler();

            var certFile = env.ApplicationBasePath + $"{System.IO.Path.DirectorySeparatorChar}idsrv3test.pfx";

            var idsrvOptions = new IdentityServerOptions
            {
                Factory = new IdentityServerServiceFactory()
                                .UseInMemoryUsers(Users.Get())
                                .UseInMemoryClients(Clients.Get())
                                .UseInMemoryScopes(Scopes.Get()),

                SigningCertificate = new X509Certificate2(certFile, "idsrv3test"),
                RequireSsl = false,
                
            };
            
            app.UseIdentityServer(idsrvOptions);
        }
开发者ID:onagirnyak,项目名称:OStore,代码行数:20,代码来源:Startup.cs

示例13: Configure

        public void Configure(IApplicationBuilder app, IApplicationEnvironment env)
        {
            var certFile = Path.Combine(env.ApplicationBasePath, "idsrv3test.pfx");

            var factory = IdSvr.Factory.Configure();
            var idsrvOptions  = new IdentityServerOptions
            {
                Factory = factory,
                SigningCertificate = new X509Certificate2(certFile, "idsrv3test"),
                RequireSsl = false
            };

            app.UseStaticFiles();
            app.UseMvc(routes =>
            {
                routes.MapRoute(name: "default", template: "{controller=Home}/{action=Index}/{id?}");
            });

            app.UseIdentityServer(idsrvOptions);
        }
开发者ID:javagg,项目名称:idsvr3-mono,代码行数:20,代码来源:Startup.cs

示例14: Configure

        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IApplicationEnvironment env, ILoggerFactory loggerFactory,
            ScopeConfigurationContext scopeContext, ClientConfigurationContext clientContext)
        {
            loggerFactory.AddConsole(Configuration.GetSection("Logging"));
            loggerFactory.AddDebug();

            app.UseIISPlatformHandler();

            app.UseStaticFiles();

            X509Certificate2 certificate = null;
            var certFile = env.ApplicationBasePath + $"{System.IO.Path.DirectorySeparatorChar}idsrv3test.pfx";
            certificate = new X509Certificate2(certFile, "idsrv3test", X509KeyStorageFlags.MachineKeySet);

            var factory = new IdentityServerServiceFactory();
            factory.ConfigureEntityFramework(app.ApplicationServices)
                .RegisterOperationalStores<OperationalContext>()
                .RegisterClientStore<Guid, ClientConfigurationContext>()
                .RegisterScopeStore<Guid, ScopeConfigurationContext>();
            factory.UseInMemoryUsers(Users.Get());

            var idsvrOptions = new IdentityServerOptions
            {
                SiteName = "Sample Site",
                Factory = factory,
                SigningCertificate = certificate,
                RequireSsl = false
            };

            app.UseIdentityServer(idsvrOptions);

            var scopeinit = new ScopeConfigurationInitializer(scopeContext);
            var clientinit = new ClientConfigurationInitializer(clientContext);

            scopeinit.InitializeData();
            clientinit.InitializeData();
        }
开发者ID:Junicus,项目名称:Sample2020,代码行数:38,代码来源:Startup.cs

示例15: Configure

        public void Configure(IApplicationBuilder app)
        {
            if (CookieAuthenticationScheme != null)
            {
                app.UseCookieAuthentication(options =>
                {
                    options.AuthenticationScheme = CookieAuthenticationScheme;
                });
            }

            app.UseIdentityServer();

            app.Map(Constants.RoutePaths.Login.EnsureLeadingSlash(), path =>
            {
                path.Run(ctx => Login(ctx));
            });

            app.Map(Constants.RoutePaths.Consent.EnsureLeadingSlash(), path =>
            {
                path.Run(ctx => Consent(ctx));
            });

            app.Map(Constants.RoutePaths.Error.EnsureLeadingSlash(), path =>
            {
                path.Run(ctx => Error(ctx));
            });
        }
开发者ID:haoas,项目名称:IdentityServer4,代码行数:27,代码来源:MockAuthorizationPipeline.cs


注:本文中的IApplicationBuilder.UseIdentityServer方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。