예제 #1
0
 protected void Application_Start()
 {
     EnsureAuthIndexes.Exist();
     AreaRegistration.RegisterAllAreas();
     GlobalConfiguration.Configure(WebApiConfig.Register);
     FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
     RouteConfig.RegisterRoutes(RouteTable.Routes);
     BundleConfig.RegisterBundles(BundleTable.Bundles);
 }
예제 #2
0
        public void Configuration(IAppBuilder app)
        {
            EnsureAuthIndexes.Exist();
            HttpConfiguration config = new HttpConfiguration();

            DataProtectionProvider = app.GetDataProtectionProvider();
            var container = SimpleInjectorInitializer.Initialize(config);

            IClientService clientService;

            using (container.BeginExecutionContextScope())
            {
                clientService = container.GetInstance <IClientService>();
            }

            WebApiConfig.Register(config);
            app.UseOAuthAuthorizationServer(OAuthTokenOptions(clientService));
            app.UseJwtBearerAuthentication(OAuthTokenConsumption());
            app.UseCors(Microsoft.Owin.Cors.CorsOptions.AllowAll);
            app.UseWebApi(config);
        }