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


C# IAppBuilder.UseIdentityServer方法代码示例

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


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

示例1: Configuration

        public void Configuration(IAppBuilder app)
        {
            // tracing
            Log.Logger = new LoggerConfiguration()
                .WriteTo.Trace()
                .CreateLogger();

            // in-memory datenhaltung für users, scopes, clients und CORS policys
            var users = new InMemoryUserService(Users.Get());
            var scopes = new InMemoryScopeStore(Scopes.Get());
            var clients = new InMemoryClientStore(Clients.Get());
            var cors = new InMemoryCorsPolicyService(Clients.Get());

            // konfigurieren der factory
            var factory = new IdentityServerServiceFactory();

            factory.UserService = new Registration<IUserService>(users);
            factory.ScopeStore = new Registration<IScopeStore>(scopes);
            factory.ClientStore = new Registration<IClientStore>(clients);
            factory.CorsPolicyService = new Registration<ICorsPolicyService>(cors);

            // identityserver3 middleware einbinden
            app.UseIdentityServer(new IdentityServerOptions
                {
                    Factory = factory,
                    SiteName = "DotNetPro IdentityServer",

                    SigningCertificate = Certificate.Get()
                });
        }
开发者ID:EdWin1409,项目名称:DotNetProIdentityServerArtikel,代码行数:30,代码来源:Startup.cs

示例2: Configuration

        public void Configuration(IAppBuilder app)
        {
            var connectionString = "MembershipReboot";

            app.Map("/admin", adminApp =>
            {
                var factory = new IdentityManagerServiceFactory();
                factory.Configure(connectionString);

                adminApp.UseIdentityManager(new IdentityManagerOptions()
                {
                    Factory = factory
                });
            });


            var idSvrFactory = Factory.Configure();
            idSvrFactory.ConfigureCustomUserService(connectionString);

            var options = new IdentityServerOptions
            {
                IssuerUri = "https://idsrv3.com",
                SiteName = "Thinktecture IdentityServer3 - UserService-MembershipReboot",
                
                SigningCertificate = Certificate.Get(),
                Factory = idSvrFactory,
                CorsPolicy = CorsPolicy.AllowAll,
                AuthenticationOptions = new AuthenticationOptions{
                    IdentityProviders = ConfigureAdditionalIdentityProviders,
                }
            };

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

示例3: Configuration

        public void Configuration(IAppBuilder app)
        {
            // Configuring logging
            LogProvider.SetCurrentLogProvider(new DiagnosticsTraceLogProvider());

            // Configuring thinktecture identity manager
            app.Map("/admin", adminApp =>
            {
                var adminFactory = new IdentityManagerServiceFactory();
                adminFactory.ConfigureSimpleIdentityManagerService();

                adminApp.UseIdentityManager(new IdentityManagerOptions
                {
                    Factory = adminFactory
                });
            });

            // Configuring thinktecture auth server with Asp.Net identity
            var factory = Factory.Configure();
            factory.ConfigureCustomServices();
            var options = new IdentityServerOptions
            {
                SiteName = "My Auth Server",
                RequireSsl = false,
                SigningCertificate = Certificate.Load(),
                Factory = factory,
                CorsPolicy = CorsPolicy.AllowAll
            };
            app.UseIdentityServer(options);
        }
开发者ID:umair-ali,项目名称:ThinkTecture-IdentityServer-POC-COMPLETE,代码行数:30,代码来源:Startup.cs

示例4: Configuration

        public void Configuration(IAppBuilder appBuilder)
        {
            var factory = InMemoryFactory.Create(
                users:   Users.Get(), 
                clients: Clients.Get(), 
                scopes:  Scopes.Get());

            factory.ClaimsProvider = 
                new Registration<IClaimsProvider>(typeof(CustomClaimsProvider));
            factory.UserService = 
                new Registration<IUserService>(typeof(CustomUserService));
            factory.CustomGrantValidator = 
                new Registration<ICustomGrantValidator>(typeof(CustomGrantValidator));

            var options = new IdentityServerOptions
            {
                IssuerUri = "https://idsrv3.com",
                SiteName = "Thinktecture IdentityServer3 (CustomGrants)",
                RequireSsl = false,

                SigningCertificate = Certificate.Get(),
                Factory = factory,
            };

            appBuilder.UseIdentityServer(options);
        }
开发者ID:MauricioArroyo,项目名称:IdentityServer3.Samples,代码行数:26,代码来源:Startup.cs

示例5: Configuration

        public void Configuration(IAppBuilder appBuilder)
        {
            Log.Logger = new LoggerConfiguration()
                .WriteTo.ColoredConsole(
                    outputTemplate: "{Timestamp:HH:mm} [{Level}] ({Name}) {NewLine} {Message}{NewLine}{Exception}")
                .CreateLogger();

            LogProvider.SetCurrentLogProvider(new SerilogLogProvider());

            var factory = InMemoryFactory.Create(
                users:   Users.Get(), 
                clients: Clients.Get(), 
                scopes:  Scopes.Get());

            var options = new IdentityServerOptions
            {
                IssuerUri = "https://idsrv3.com",
                SiteName = "Thinktecture IdentityServer3 (self host)",

                SigningCertificate = Certificate.Get(),
                Factory = factory,
            };

            appBuilder.UseIdentityServer(options);
        }
开发者ID:MauricioArroyo,项目名称:IdentityServer3.Samples,代码行数:25,代码来源:Startup.cs

示例6: Configuration

        public void Configuration(IAppBuilder appBuilder)
        {
            Log.Logger = new LoggerConfiguration()
                .WriteTo.Trace(outputTemplate: "{Timestamp} [{Level}] ({Name}){NewLine} {Message}{NewLine}{Exception}")
                .CreateLogger();

            appBuilder.Map("/windows", ConfigureWindowsTokenProvider);

            var factory = new IdentityServerServiceFactory()
                .UseInMemoryClients(Clients.Get())
                .UseInMemoryScopes(Scopes.Get());
            factory.UserService = new Registration<IUserService>(typeof(ExternalRegistrationUserService));

            var options = new IdentityServerOptions
            {
                SigningCertificate = Certificate.Load(),
                Factory = factory,
                AuthenticationOptions = new AuthenticationOptions
                {
                    EnableLocalLogin = false,
                    IdentityProviders = ConfigureIdentityProviders
                }
            };

            appBuilder.UseIdentityServer(options);
        }
开发者ID:dkaminski,项目名称:IdentityServer3.Samples,代码行数:26,代码来源:Startup.cs

示例7: Configuration

        public void Configuration(IAppBuilder appBuilder)
        {
            var factory = new IdentityServerServiceFactory()
                               .UseInMemoryUsers(Users.Get())
                               .UseInMemoryScopes(Scopes.Get())
                               .UseInMemoryClients(Clients.Get());

            factory.ClaimsProvider = 
                new Registration<IClaimsProvider>(typeof(CustomClaimsProvider));
            factory.UserService = 
                new Registration<IUserService>(typeof(CustomUserService));
            factory.CustomGrantValidators.Add( 
                new Registration<ICustomGrantValidator>(typeof(CustomGrantValidator)));

            var options = new IdentityServerOptions
            {
                SiteName = "IdentityServer3 (CustomGrants)",
                RequireSsl = false,

                SigningCertificate = Certificate.Get(),
                Factory = factory,
            };

            appBuilder.UseIdentityServer(options);
        }
开发者ID:camainc,项目名称:IdentityServer3.Samples,代码行数:25,代码来源:Startup.cs

示例8: Configuration

        public void Configuration(IAppBuilder app)
        {
            var config = new HttpConfiguration();
            WebApiConfig.Register(config);
            app.UseIdentityServerBearerTokenAuthentication(new IdentityServerBearerTokenAuthenticationOptions
            {
                Authority = "http://localhost:52401",//Your url here
                RequiredScopes = new[] {"api"}
            });

            app.UseWebApi(config);
            var factory = InMemoryFactory.Create(Config.GetUsers().ToList(), Config.GetClients(), Config.GetScopes());
            app.UseIdentityServer(new IdentityServerOptions
            {
                IssuerUri = "urn:identity",
                Factory = factory,
                RequireSsl = false, //DO NOT DO THIS IN PRODUCTION
                LoggingOptions = new LoggingOptions
                {
                 EnableWebApiDiagnostics   = true,
                 WebApiDiagnosticsIsVerbose = true
                },
                SigningCertificate = LoadCertificate()

            });
            app.UseNLog();
        }
开发者ID:yuva2achieve,项目名称:SingleSignOnDemo,代码行数:27,代码来源:Startup.cs

示例9: Configuration

        public void Configuration(IAppBuilder app)
        {
            app.Map("/admin", adminApp =>
            {
                var factory = new IdentityManagerServiceFactory();
                factory.ConfigureSimpleIdentityManagerService("AspId");
                //factory.ConfigureCustomIdentityManagerServiceWithIntKeys("AspId_CustomPK");

                adminApp.UseIdentityManager(new IdentityManagerOptions()
                {
                    Factory = factory
                });
            });

            var idSvrFactory = Factory.Configure();
            idSvrFactory.ConfigureUserService("AspId");
            //idSvrFactory.ConfigureCustomUserService("AspId_CustomPK");

            var options = new IdentityServerOptions
            {
                SiteName = "Thinktecture IdentityServer3 - UserService-AspNetIdentity",
                SigningCertificate = Certificate.Get(),
                Factory = idSvrFactory,
                CorsPolicy = CorsPolicy.AllowAll,
                AuthenticationOptions = new AuthenticationOptions
                {
                    IdentityProviders = ConfigureAdditionalIdentityProviders,
                }
            };

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

示例10: Configuration

        public void Configuration(IAppBuilder app)
        {
            var connString = "AspId";
            //var connString = "CustomAspId";

            app.Map("/admin", adminApp =>
            {
                var factory = new AspNetIdentityIdentityManagerFactory(connString);
                adminApp.UseIdentityManager(new IdentityManagerConfiguration()
                {
                    IdentityManagerFactory = factory.Create
                });
            });

            var options = new IdentityServerOptions
            {
                IssuerUri = "https://idsrv3.com",
                SiteName = "Thinktecture IdentityServer v3 - UserService-AspNetIdentity",
                PublicHostName = "http://localhost:3333",

                SigningCertificate = Certificate.Get(),
                Factory = Factory.Configure(connString),
                CorsPolicy = CorsPolicy.AllowAll
            };

            app.UseIdentityServer(options);
        }
开发者ID:cb55555,项目名称:Thinktecture.IdentityServer.v3.AspNetIdentity,代码行数:27,代码来源:Startup.cs

示例11: Configuration

        public void Configuration(IAppBuilder app)
        {
            var users = new List<InMemoryUser>
            {
                new InMemoryUser
                {
                    Subject = "E4A8B8DA-87F9-41CB-AA33-F79E621B3A56",
                    Username = "[email protected]",
                    Password = "password",
                    Claims = new List<Claim>
                    {
                        new Claim("email", "[email protected]"),
                        new Claim("role", "badmin")
                    }
                }
            };

            var factory =
                new IdentityServerServiceFactory()
                    .UseInMemoryUsers(users)
                    .UseInMemoryScopes(new List<Scope>())
                    .UseInMemoryClients(new List<Client>());

            app.UseIdentityServer(new IdentityServerOptions
            {
                Factory = factory,
                SigningCertificate = Cert.LoadSigning(),
                PluginConfiguration = PluginConfiguration
            });
        }
开发者ID:scottbrady91,项目名称:Blog-Example-Classes,代码行数:30,代码来源:Startup.cs

示例12: Configuration

		public void Configuration(IAppBuilder appBuilder)
        {
			//AntiForgeryConfig.UniqueClaimTypeIdentifier = Constants.ClaimTypes.Subject;
			//JwtSecurityTokenHandler.InboundClaimTypeMap = new Dictionary<string, string>();

			Log.Logger = new LoggerConfiguration()
			   .MinimumLevel.Debug()
			   .WriteTo.LiterateConsole(outputTemplate: "{Timestamp} [{Level}] ({Name}){NewLine} {Message}{NewLine}{Exception}")
			   .CreateLogger();

			var factory = new IdentityServerServiceFactory()
                            .UseInMemoryClients(Clients.Get())
                            .UseInMemoryScopes(Scopes.Get());

			// Register our custom user service
			factory.UserService = new Registration<IUserService>(new CustomInMemoryUserService(Users.Get()));
			
            var options = new IdentityServerOptions
            {
                SiteName = "Kroll Secure Token Service",
				IssuerUri = "https://kroll-sts-local",
				
                SigningCertificate = Certificate.Get(),
                Factory = factory,
                PluginConfiguration = ConfigurePlugins,
				AuthenticationOptions = new IdentityServer3.Core.Configuration.AuthenticationOptions
				{
					EnablePostSignOutAutoRedirect = true,
					IdentityProviders = ConfigureIdentityProviders,
					EnableLocalLogin = false
				}
			};

            appBuilder.UseIdentityServer(options);
        }
开发者ID:obosha,项目名称:IdentityServer3,代码行数:35,代码来源:Startup.cs

示例13: Configuration

        public void Configuration(IAppBuilder appBuilder)
        {
            var factory = new IdentityServerServiceFactory()
                .UseInMemoryClients(Clients.Get())
                .UseInMemoryScopes(Scopes.Get())
                .UseInMemoryUsers(Users.Get());

            factory.EventService = new Registration<IEventService, SeqEventService>();

            var options = new IdentityServerOptions
            {
                SiteName = "IdentityServer3 (self host)",

                SigningCertificate = Certificate.Get(),
                Factory = factory,

                EventsOptions = new EventsOptions
                {
                    RaiseErrorEvents = true,
                    RaiseFailureEvents = true,
                    RaiseInformationEvents = true,
                    RaiseSuccessEvents = true
                }
            };

            appBuilder.UseIdentityServer(options);
        }
开发者ID:ryanmar,项目名称:IdentityServer3.Samples,代码行数:27,代码来源:Startup.cs

示例14: Configuration

        public void Configuration(IAppBuilder appBuilder)
        {
            Log.Logger = new LoggerConfiguration()
               .MinimumLevel.Debug()
               .WriteTo.Trace()
               .CreateLogger();

            var factory = new IdentityServerServiceFactory()
                .UseInMemoryUsers(Users.Get())
                .UseInMemoryClients(Clients.Get()) 
                .UseInMemoryScopes(Scopes.Get());

            factory.ClaimsProvider = new Registration<IClaimsProvider, MyCustomClaimsProvider>();
            factory.Register(new Registration<ICustomLogger, MyCustomDebugLogger>());
            factory.CorsPolicyService = new Registration<ICorsPolicyService>(new DefaultCorsPolicyService { AllowAll = true });

            var options = new IdentityServerOptions
            {
                SiteName = "IdentityServer3 - DependencyInjection",

                SigningCertificate = Certificate.Get(),
                Factory = factory,
            };

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

示例15: Configuration

        public void Configuration(IAppBuilder app)
        {
            Log.Logger = new LoggerConfiguration()
                .MinimumLevel.Debug()
                .WriteTo.Trace()
                .CreateLogger();

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


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