示例#1
0
        private static void SetupAuth(IAppBuilder app, KernelBase kernel)
        {
            app.UseFormsAuthentication(new FormsAuthenticationOptions
            {
                LoginPath = "/account/login",
                LogoutPath = "/account/logout",
                CookieHttpOnly = true,
                AuthenticationType = Constants.JabbRAuthType,
                CookieName = "jabbr.id",
                ExpireTimeSpan = TimeSpan.FromDays(30),
                DataProtection = kernel.Get<IDataProtection>(),
                Provider = kernel.Get<IFormsAuthenticationProvider>()
            });

            //var config = new FederationConfiguration(loadConfig: false);
            //config.WsFederationConfiguration.Issuer = "";
            //config.WsFederationConfiguration.Realm = "http://localhost:16207/";
            //config.WsFederationConfiguration.Reply = "http://localhost:16207/wsfederation";
            //var cbi = new ConfigurationBasedIssuerNameRegistry();
            //cbi.AddTrustedIssuer("", "");
            //config.IdentityConfiguration.AudienceRestriction.AllowedAudienceUris.Add(new Uri("http://localhost:16207/"));
            //config.IdentityConfiguration.IssuerNameRegistry = cbi;
            //config.IdentityConfiguration.CertificateValidationMode = X509CertificateValidationMode.None;
            //config.IdentityConfiguration.CertificateValidator = X509CertificateValidator.None;

            //app.UseFederationAuthentication(new FederationAuthenticationOptions
            //{
            //    ReturnPath = "/wsfederation",
            //    SigninAsAuthenticationType = Constants.JabbRAuthType,
            //    FederationConfiguration = config,
            //    Provider = new FederationAuthenticationProvider()
            //});

            app.Use(typeof(WindowsPrincipalHandler));
        }
 public void Setup()
 {
     kernel = new StandardKernel(new NinjectAPIModule());
     nutritionalInformationController = kernel.Get<NutritionalInformationController>();
     nutritionalInformationController.Request = Substitute.For<HttpRequestMessage>();
     nutritionalInformationController.Configuration = Substitute.For<HttpConfiguration>();
 }
 public void Setup()
 {
     kernel = new StandardKernel(new NinjectAPIModule());
     uriLocationsController = kernel.Get<UriLocationsController>();
     uriLocationsController.Request = Substitute.For<HttpRequestMessage>();
     uriLocationsController.Configuration = Substitute.For<HttpConfiguration>();
 }
 public void Setup()
 {
     kernel = new StandardKernel(new NinjectAPIModule());
     clientService = kernel.Get<ClientService>();
 }
 public void Setup()
 {
     kernel = new StandardKernel(new NinjectAPIModule());
     recipeManager = kernel.Get<RecipeManager>();
 }