• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Configuration.IdentityServerOptions类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中IdentityServer3.Core.Configuration.IdentityServerOptions的典型用法代码示例。如果您正苦于以下问题:C# IdentityServerOptions类的具体用法?C# IdentityServerOptions怎么用?C# IdentityServerOptions使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



IdentityServerOptions类属于IdentityServer3.Core.Configuration命名空间,在下文中一共展示了IdentityServerOptions类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: Configuration

        public void Configuration(IAppBuilder app)
        {
            app.Map("/idmgr", adminApp =>
            {
                var factory = new IdentityManagerServiceFactory();
                factory.ConfigureSimpleIdentityManagerService("DefaultConnection");

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

            app.Map("/idsvr", core =>
            {
                var idSvrFactory = Factory.Configure();
                idSvrFactory.ConfigureUserService("DefaultConnection");

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

                core.UseIdentityServer(options);
            });
        }
开发者ID:dtuit,项目名称:IdentityServer_BasicSetup,代码行数:32,代码来源:Startup.cs


示例2: Configuration

        public void Configuration(IAppBuilder app)
        {
            // setup serilog to use diagnostics trace
            Log.Logger = new LoggerConfiguration()
                .WriteTo.Trace(outputTemplate: "{Timestamp} [{Level}] ({Name}){NewLine} {Message}{NewLine}{Exception}")
                .CreateLogger();

            app.Map("/core", coreApp =>
            {
                var factory = new IdentityServerServiceFactory()
                    .UseInMemoryUsers(Users.Get())
                    .UseInMemoryClients(Clients.Get())
                    .UseInMemoryScopes(Scopes.Get());

                var options = new IdentityServerOptions
                {
                    SiteName = "IdentityServer3 with WS-Federation",

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

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


示例3: Configuration

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

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

                    var adminOptions = new IdentityManagerOptions(){
                        Factory = factory
                    };
                    adminOptions.SecurityConfiguration.RequireSsl = false;
                    adminApp.UseIdentityManager(adminOptions);
                });

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

            var viewOptions = new ViewServiceOptions
            {
                TemplatePath = this.basePath.TrimEnd(new char[] { '/' })
            };
            idSvrFactory.ViewService = new IdentityServer3.Core.Configuration.Registration<IViewService>(new ViewService(viewOptions));

            var options = new IdentityServerOptions
            {
                SiteName = "IdentityServer3 - ViewSerive-AspNetIdentity",
                SigningCertificate = Certificate.Get(),
                Factory = idSvrFactory,
                RequireSsl = false,
                AuthenticationOptions = new AuthenticationOptions
                {
                    IdentityProviders = ConfigureAdditionalIdentityProviders,
                }
            };

            app.Map("/core", core =>
            {
                core.UseIdentityServer(options);
            });

            app.UseStaticFiles(new StaticFileOptions
            {
                RequestPath = new PathString("/Content"),
                FileSystem = new PhysicalFileSystem(Path.Combine(this.basePath, "Content")) 
            });

            var config = new HttpConfiguration();
          //  config.MapHttpAttributeRoutes();
            config.Routes.MapHttpRoute("API", "api/{controller}/{action}", new { controller = "Home", action = "Get" });
            app.UseWebApi(config);
        }
开发者ID:mequanta,项目名称:Janitor-old,代码行数:60,代码来源:Startup.cs


示例4: Configuration

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

            app.Map("/core", coreApp =>
            {
                var factory = new IdentityServerServiceFactory()
                    .UseInMemoryUsers(Users.Get())
                    .UseInMemoryClients(Clients.Get())
                    .UseInMemoryScopes(Scopes.Get());

                var viewOptions = new DefaultViewServiceOptions();
                viewOptions.Stylesheets.Add("/Content/Site.css");
                viewOptions.CacheViews = false;
                factory.ConfigureDefaultViewService(viewOptions);

                var options = new IdentityServerOptions
                {
                    SiteName = "IdentityServer3 - Configuring DefaultViewService",

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

                    AuthenticationOptions = new AuthenticationOptions{
                        IdentityProviders = ConfigureAdditionalIdentityProviders,
                    }
                };

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


示例5: AccessTokenValidationController

 public AccessTokenValidationController(TokenValidator validator, IdentityServerOptions options, ILocalizationService localizationService, IEventService events)
 {
     _validator = validator;
     _options = options;
     _localizationService = localizationService;
     _events = events;
 }
开发者ID:nheijminkccv,项目名称:IdentityServer3,代码行数:7,代码来源:AccessTokenValidationController.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)
        {
            Log.Logger = new LoggerConfiguration()
                .WriteTo.Trace(outputTemplate: "{Timestamp} [{Level}] ({Name}){NewLine} {Message}{NewLine}{Exception}")
                .CreateLogger();

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

            // Use the Mvc View Service instead of the default
            factory.ViewService = new Registration<IViewService, MvcViewService<LogonWorkflowController>>();

            // These registrations are also needed since these are dealt with using non-standard construction
            factory.Register(new Registration<HttpContext>(resolver => HttpContext.Current));
            factory.Register(new Registration<HttpContextBase>(resolver => new HttpContextWrapper(resolver.Resolve<HttpContext>())));
            factory.Register(new Registration<HttpRequestBase>(resolver => resolver.Resolve<HttpContextBase>().Request));
            factory.Register(new Registration<HttpResponseBase>(resolver => resolver.Resolve<HttpContextBase>().Response));
            factory.Register(new Registration<HttpServerUtilityBase>(resolver => resolver.Resolve<HttpContextBase>().Server));
            factory.Register(new Registration<HttpSessionStateBase>(resolver => resolver.Resolve<HttpContextBase>().Session));

            var options = new IdentityServerOptions
            {
                SigningCertificate = Certificate.Load(),
                Factory = factory
            };

            appBuilder.Map("/core", idsrvApp =>
                {
                    idsrvApp.UseIdentityServer(options);
                });
        }
开发者ID:ryanmar,项目名称:IdentityServer3.Samples,代码行数:33,代码来源:Startup.cs


示例8: Configuration

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

            Log.Debug("starting log.  do not remove this line.");
            LogProvider.GetLogger(typeof(Startup)).Log(LogLevel.Debug, () => "starting up");

            app.Map("/core", core =>
            {
                var idSvrFactory = Factory.Configure();
                idSvrFactory.ConfigureCustomUserService("Xyz");

                var options = new IdentityServerOptions
                {
                    SiteName = "Xyz University - Identity Server",

                    SigningCertificate = Certificate.Get(),
                    Factory = idSvrFactory,
                    AuthenticationOptions = new AuthenticationOptions
                    {
                        IdentityProviders = ConfigureAdditionalIdentityProviders,
                    }
                };

                core.UseIdentityServer(options);
            });
        }
开发者ID:fredimartins,项目名称:XYZUniversityBackend,代码行数:30,代码来源:Startup.cs


示例9: Configuration

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

            app.Map("/core", coreApp =>
            {
                var factory = new IdentityServerServiceFactory()
                    .UseInMemoryUsers(Users.Get())
                    .UseInMemoryClients(Clients.Get())
                    .UseInMemoryScopes(Scopes.Get());

                factory.ViewService = new Registration<IViewService>(typeof(CustomViewService));
                //factory.UserService = new Registration<IUserService, UserService>();
                factory.CorsPolicyService = new Registration<ICorsPolicyService>(new DefaultCorsPolicyService { AllowAll = true });

                var options = new IdentityServerOptions
                {
                    SiteName = "IdentityServer33 - CustomViewService",

                    SigningCertificate = Certificate.Get(),
                    Factory = factory,
                    AuthenticationOptions = new AuthenticationOptions {
                        IdentityProviders = ConfigureAdditionalIdentityProviders,
                    }
                };

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


示例10: GetRedirectUrl

        public static string GetRedirectUrl(SignOutMessage message, IDictionary<string, object> env, IdentityServerOptions options)
        {
            var result = new LogoutResult(message, env, options);
            var response = result.Execute();

            return response.Headers.Location.AbsoluteUri;
        }
开发者ID:284247028,项目名称:IdentityServer3,代码行数:7,代码来源:LogoutResult.cs


示例11: 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


示例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: InitializeIdServer

        /// <summary>
        /// Configura o mecanismo de identitdade, de acordo com o as configurações do idFactory.
        /// </summary>
        /// <param name="app"></param>
        /// <param name="namerOrConnStr"></param>
        /// <param name="idFactory"></param>
        public void InitializeIdServer(IAppBuilder app, string namerOrConnStr, IdentityServerServiceFactory idFactory)
        {
            #region CONFIGURAÇÃO DO IDENTITY SERVER
            app.Map("/identity", id => {

                var options = new IdentityServerOptions {
                    SiteName = "GAC ERP Identity Server",
                    SigningCertificate = Certificado.Get(),
                    Factory = idFactory,
                    AuthenticationOptions = new AuthenticationOptions {
                        LoginPageLinks = new LoginPageLink[] {
                            new LoginPageLink{
                                Href = "/Account/ForgotPassword",
                                Text = "Esqueceu sua senha?"
                            }
                        },
                        EnableSignOutPrompt = false,
                        EnablePostSignOutAutoRedirect = true
                    },

                };

                id.UseIdentityServer(options);

            });
            #endregion
        }
开发者ID:gacalves,项目名称:GAC_ERP,代码行数:33,代码来源:Startup.Provider.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)
        {



            // For more information on how to configure your application, visit http://go.microsoft.com/fwlink/?LinkID=316888

            app.Map("/identity", idsrvApp =>

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

                        var options = new IdentityServerOptions
                        {
                            Factory = idServerServiceFactory,
                            SiteName = "TripCompany Security Token service",
                            IssuerUri = TripGallery.Constants.TripGalleryIssuerUri,
                            PublicOrigin = TripGallery.Constants.TripGallerySTSOrigin ,
                            SigningCertificate = LoadCertificate()
                        };


                        idsrvApp.UseIdentityServer(options);

                    }
                );
        
        }
开发者ID:thekane,项目名称:identity-server-3-samples,代码行数:31,代码来源:Startup.cs


示例16: SignInResponseGenerator

 public SignInResponseGenerator(IdentityServerOptions options, IUserService users, OwinEnvironmentService owinEnvironment, ICustomWsFederationClaimsService customClaimsService)
 {
     _options = options;
     _users = users;
     _environment = owinEnvironment.Environment;
     _customClaimsService = customClaimsService;
 }
开发者ID:nvmlabs,项目名称:IdentityServer3.WsFederation,代码行数:7,代码来源:SignInResponseGenerator.cs


示例17: 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


示例18: Configuration

        public void Configuration(IAppBuilder app)
        {
            app.Map("/identity", inner =>
            {
                var option = new IdentityServerOptions
                {
                    RequireSsl = false,
                    SiteName = "Same Server Identity Service",
                    EnableWelcomePage = false,
                    Factory = new IdentityServerServiceFactory()
                            .UseInMemoryClients(Clients.Get())
                            .UseInMemoryScopes(Scopes.Get())
                            .UseInMemoryUsers(Users.Get())
                };

                inner.UseIdentityServer(option);
            });

            app.UseIdentityServerBearerTokenAuthentication(new IdentityServerBearerTokenAuthenticationOptions()
            {
                Authority = "http://localhost:4560/identity",
                ValidationMode = ValidationMode.Both,
                RequiredScopes = new[] { "read", "api1" },
                DelayLoadMetadata = true
            });


            Log.Logger = new LoggerConfiguration()
                .MinimumLevel.Debug() // change with your desired log level
                .WriteTo.Trace()
                //.WriteTo.File(@"C:\myPath.txt") // remember to assign proper writing privileges on the file
                .CreateLogger();

        }
开发者ID:oneandy,项目名称:IdentityServer3-Single-Poject-Sample,代码行数:34,代码来源:Startup.cs


示例19: UseIdentityServer

        public static void UseIdentityServer(this IApplicationBuilder app, IdentityServerOptions options)
        {
            
            app.UseOwin(pipeline =>
            {
                pipeline(next =>
                {
                    var builder = new Microsoft.Owin.Builder.AppBuilder();
                    var provider = app.ApplicationServices.GetService<DataProtection.IDataProtectionProvider>();

                    builder.Properties["security.DataProtectionProvider"] = new DataProtectionProviderDelegate(purposes =>
                    {
                        var dataProtection = provider.CreateProtector(String.Join(",", purposes));
                        return new DataProtectionTuple(dataProtection.Protect, dataProtection.Unprotect);
                    });

                    builder.Map("/admin", adminApp =>
                    {
                        var factory = new IdentityManagerServiceFactory();
                        factory.ConfigureSimpleIdentityManagerService("AspId");
                        //factory.ConfigureCustomIdentityManagerServiceWithIntKeys("AspId_CustomPK");

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

                    builder.UseIdentityServer(options);
                    builder.UseAesDataProtectorProvider();
                    var appFunc = builder.Build(typeof(Func<IDictionary<string, object>, Task>)) as Func<IDictionary<string, object>, Task>;
                    return appFunc;
                });
            });
        }
开发者ID:mequanta,项目名称:Janitor-old,代码行数:35,代码来源:IApplicationBuilderExtensions.cs


示例20: 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



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Models.SignInMessage类代码示例发布时间:2022-05-26
下一篇:
C# Models.ApplicationUser类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap