Example #1
0
 protected void Application_Start()
 {
     FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
     GlobalConfiguration.Configure(WebApiConfig.Register);
     AutofacWebApi.Initialize(GlobalConfiguration.Configuration);
     RouteConfig.RegisterRoutes(RouteTable.Routes);
 }
Example #2
0
        protected void Application_Start()
        {
            var config = GlobalConfiguration.Configuration;

            RouteConfig.RegisterRoutes(config);
            WebApiConfig.Configure(config);
            AutofacWebApi.Initialize(config);
        }
Example #3
0
        protected void Application_Start(object sender, EventArgs e)
        {
            HttpConfiguration             config     = GlobalConfiguration.Configuration;
            ITenantIdentificationStrategy idStrategy =
                new ContextItemsTenantIdentificationStrategy("App:Tenant");

            config.MessageHandlers.Add(new TenantIdentifierMessageHandler());

            AutofacWebApi.Initialize(config, idStrategy);
            WebApiConfig.Configure(config);
            RouteConfig.RegisterRoutes(config);
        }
Example #4
0
        public void Configuration(IAppBuilder app)
        {
            //ApplicationUserManager.DataProtectionProvider = new DpapiDataProtectionProvider("api.yesfeiras");
            ApplicationUserManager.DataProtectionProvider = new MachineKeyProtectionProvider();

            // For more information on how to configure your application, visit http://go.microsoft.com/fwlink/?LinkID=316888
            HttpConfiguration config = new HttpConfiguration();

            config.IncludeErrorDetailPolicy = IncludeErrorDetailPolicy.Always;

            config.Services.Replace(typeof(IAssembliesResolver), new TestWebApiResolver());

            app.CreatePerOwinContext(ApplicationDbContext.Create);
            app.CreatePerOwinContext <ApplicationUserManager>(ApplicationUserManager.Create);

            // Enable the application to use a cookie to store information for the signed in user
            // and to use a cookie to temporarily store information about a user logging in with a third party login provider
            app.UseCookieAuthentication(new CookieAuthenticationOptions());
            app.UseExternalSignInCookie(DefaultAuthenticationTypes.ExternalCookie);

            // Configure the application for OAuth based flow
            PublicClientId = "self";
            OAuthOptions   = new OAuthAuthorizationServerOptions
            {
                TokenEndpointPath         = new PathString("/Token"),
                Provider                  = new ApplicationOAuthProvider(PublicClientId),
                AuthorizeEndpointPath     = new PathString("/api/Account/ExternalLogin"),
                AccessTokenExpireTimeSpan = TimeSpan.FromDays(14),
                // In production mode set AllowInsecureHttp = false
                AllowInsecureHttp = true
            };

            // Enable the application to use bearer tokens to authenticate users
            app.UseOAuthBearerTokens(OAuthOptions);

            WebApiConfig.Register(config);
            AutofacWebApi.Initialize(config, false);

            app.UseWebApi(config);
        }