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


C# IAppBuilder.UseAesDataProtectorProvider方法代码示例

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


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

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

示例2: ConfigureOAuth

        public void ConfigureOAuth(IAppBuilder app)
        {
            // DpapiDataProtector is not supported on Linux/OSX
            // Use UseAesDataProtector instead
            app.UseAesDataProtectorProvider();

            OAuthAuthorizationServerOptions OAuthServerOptions = new OAuthAuthorizationServerOptions()
                {
                    Provider = new SolitudeAuthorizationServerProvider(),
                    AllowInsecureHttp = true,
                    TokenEndpointPath = new PathString("/api/token"),
                    AccessTokenExpireTimeSpan = TimeSpan.FromDays(1),
                };

            app.UseOAuthAuthorizationServer(OAuthServerOptions);
            app.UseOAuthBearerAuthentication(new OAuthBearerAuthenticationOptions());
        }
开发者ID:prozum,项目名称:solitude,代码行数:17,代码来源:Startup.cs

示例3: Configuration

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

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

                SigningCertificate = Certificate.Get(),
                Factory = factory,
                RequireSsl = false
            };
            appBuilder.UseIdentityServer(options);
        }
开发者ID:javagg,项目名称:idsvr3-mono,代码行数:19,代码来源:Startup.cs

示例4: Configuration

        public void Configuration(IAppBuilder app)
        {
            // Exclude AcspNet from exclude assemblies to be able to load example controllers
            AcspTypesFinder.ExcludedAssembliesPrefixes.Remove("AcspNet");

            var provider = new SimpleInjectorDIProvider();
            DIContainer.Current = provider;

            app.UseCookieAuthentication(new CookieAuthenticationOptions
            {
                AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
                LoginPath = new PathString("/login")
            });

            app.UseAesDataProtectorProvider();

            app.UseAcspNet();

            provider.Container.Verify();

            AcspNetOwinMiddleware.OnException += Ex;
        }
开发者ID:jmptrader,项目名称:AcspNet,代码行数:22,代码来源:Startup.cs

示例5: Configure

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

            BasePath = AppDomain.CurrentDomain.BaseDirectory;
            var certFile = Path.Combine(BasePath, "idsrv3test.pfx");
            Console.WriteLine(certFile);
            var options = ConfigureIdentityServer(certFile);

            //  var cpath = Path.GetFullPath(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location),"..", "..", "..", "src", "Janitor", "Content"));
            //  Console.WriteLine(cpath);
            //  app.UseStaticFiles (new StaticFileOptions {
            //		RequestPath = new PathString("/Content"),
            //		FileSystem = new PhysicalFileSystem(cpath)
            //	});

            app.Map("/admin", adminApp =>
            {
                var factory = new IdentityManagerServiceFactory();
                factory.ConfigureSimpleIdentityManagerService("AspId");
                    var adminOptions = new IdentityManagerOptions
                        {
                            Factory = factory,

                        };
                    adminOptions.SecurityConfiguration.RequireSsl = false;
                    adminApp.UseIdentityManager(adminOptions);
            });

            app.UseIdentityServer(options);
        }
开发者ID:mequanta,项目名称:Janitor-old,代码行数:35,代码来源:Startup.cs

示例6: Configuration

        public void Configuration(IAppBuilder app)
        {
            var requireSSL = false;
            var idserverendpoint = "/identity";
            var serverReplyUrl = Path.Combine(baseUrl, idserverendpoint);

            // Publish the internal idserver to authenticate users
            app.Map(idserverendpoint, idServer => idServer.UseIdentityServer(
                    new IdentityServerOptions
                    {
                        SiteName = "MySite",
                        //SigningCertificate = CertificateLoader.LoadCertificate(_idServerSigningCertificateThumbprint),
                        Factory = GetFactory(),
                        RequireSsl = requireSSL,
                        PublicOrigin = baseUrl,
                        CspOptions = new CspOptions{ Enabled = false },
                        AuthenticationOptions = new AuthenticationOptions
                        {
                            CookieOptions = new CookieOptions
                            {
                                SecureMode = requireSSL ? CookieSecureMode.Always : CookieSecureMode.SameAsRequest
                            },
                            EnableLocalLogin = true,
                            EnableSignOutPrompt = false,
                            EnablePostSignOutAutoRedirect = false,
                            IdentityProviders = ConfigureIdentityProviders
                        }
                    }));

            app.UseCookieAuthentication(new CookieAuthenticationOptions
                {
                    AuthenticationType = "Cookies"
                });

            // Use the internal idserver for authentication
            app.UseOpenIdConnectAuthentication(new OpenIdConnectAuthenticationOptions
                {
                    Authority = serverReplyUrl,
                    ClientId = "myawesomeclient",
                    RedirectUri = baseUrl,
                    PostLogoutRedirectUri = baseUrl,
                    ResponseType = "id_token",
                    SignInAsAuthenticationType = "Cookies",
                    Notifications = new OpenIdConnectAuthenticationNotifications
                    {
                        SecurityTokenValidated = async n =>
                        {
            //                            if (_idServerRedirectAfterLogout)
            //                            {
            //                                // Store extra claim in the token received so we can prove
            //                                // our identity at sign out and allow the post sign out redirect
            //                                var identity = n.AuthenticationTicket.Identity;
            //                                identity.AddClaim(new Claim("id_token", n.ProtocolMessage.IdToken));
            //                            }
                        },
                        RedirectToIdentityProvider = async n =>
                        {
            //                            if (_idServerRedirectAfterLogout)
            //                            {
            //                                if (n.ProtocolMessage.RequestType == OpenIdConnectRequestType.LogoutRequest)
            //                                {
            //                                    // Send back the id_token we captured on validation to prove we are who we said,
            //                                    // so that the post logout re-direct can work....
            //                                    var idTokenClaim = n.OwinContext.Authentication.User.FindFirst("id_token");
            //                                    if (idTokenClaim != null)
            //                                        n.ProtocolMessage.IdTokenHint = idTokenClaim.Value;
            //                                }
            //                            }
                        }
                    }
                });

            app.UseNancy();

            //Needed to work on Mono but will work X-Plat
            app.UseAesDataProtectorProvider();

            app.UseStageMarker(PipelineStage.MapHandler);
        }
开发者ID:jchannon,项目名称:IdsrvMono,代码行数:79,代码来源:Startup.cs


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