Esempio n. 1
0
        /// <summary>
        /// The Configuration method for the app.
        /// </summary>
        /// <param name="app">The I AppBuilder</param>
        public virtual void Configuration(IAppBuilder app)
        {
            // Enable IoC
            var ioCConfig = new InversionOfControlConfig();
            var container = ioCConfig.GetInitializedContainer();

            app.UseOwinContextInjector(container);

            //Configure Authorization Server
            var authorizationServerConfig = container.GetInstance <JwtAuthorizationServerConfig>();

            authorizationServerConfig.Configure(app);

            //Configure Bearer Token Authentication
            var tokenBearerAuthenticationConfig = container.GetInstance <JwtBearerTokenAuthenticationConfig>();

            tokenBearerAuthenticationConfig.Config(app);

            // Enable WebApi with IoC
            var httpConfiguration = new HttpConfiguration
            {
                DependencyResolver = new SimpleInjectorWebApiDependencyResolver(container)
            };

            WebApiConfig.Register(httpConfiguration);
            app.UseWebApi(httpConfiguration);

            // Enable Swagger
            SwaggerConfig.Register(httpConfiguration);
        }
Esempio n. 2
0
        public void Configuration(IAppBuilder appBuilder)
        {
            var httpConfiguration = new HttpConfiguration();

            WebApiConfig.Register(httpConfiguration);
            appBuilder.UseWebApi(httpConfiguration);

            SimpleInjectorConfig.Initialize(httpConfiguration);
            SwaggerConfig.Register(httpConfiguration);
        }