Ejemplo 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);
        }
Ejemplo n.º 2
0
        /// <summary>
        ///     Configuration function of OWIN Startup.
        /// </summary>
        /// <param name="app"></param>
        public void Configuration(IAppBuilder app)
        {
            // Register web api configuration.
            GlobalConfiguration.Configure(ApiRouteConfig.Register);

            // Register route.
            MvcRouteConfig.RegisterRoutes(RouteTable.Routes);

            // Dependency injection registration.
            InversionOfControlConfig.Register();

            // Map signalr hubs.
            app.Map("/signalr", map =>
            {
                map.UseCors(CorsOptions.AllowAll);
                var hubConfiguration = new HubConfiguration();
                map.RunSignalR(hubConfiguration);
            });

            // TODO: Refer http://www.codeproject.com/Articles/876870/Implement-OAuth-JSON-Web-Tokens-Authentication-in to implement JWT Authentication.
            // Use cors.
            app.UseCors(CorsOptions.AllowAll);



            // Initiate queue services.
            InitiateQueues();
        }
Ejemplo n.º 3
0
 static Program()
 {
     _container = InversionOfControlConfig.GetInitializedContainer();
 }