// This method gets called by the runtime. Use this method to add services to the container.
        public IServiceProvider ConfigureServices(IServiceCollection services)
        {
            services.AddCors();
            var cors = new DefaultCorsPolicyService(new Logger <DefaultCorsPolicyService>(new LoggerFactory()))
            {
                AllowAll = true
            };

            services.AddSingleton <ICorsPolicyService>(cors);
            var connectionString = Configuration["ConnectionStrings:DBConnection"];

            //Begin Identity Configuration
            services.AddDbContext <ApplicationDbContext>(options => options.UseSqlServer(connectionString));
            services.AddIdentity <ApplicationUser, IdentityRole>()
            .AddEntityFrameworkStores <ApplicationDbContext>()
            .AddDefaultTokenProviders();

            services.AddMvc();
            services.AddIdentityServer()
            .AddDeveloperSigningCredential()
            .AddInMemoryApiResources(IdentityServerConfiguration.ApiResources())
            .AddInMemoryClients(IdentityServerConfiguration.Clients())
            .AddInMemoryIdentityResources(IdentityServerConfiguration.IdentityResources())
            .AddTestUsers(TestUsers.GetUsers());

            //End Identity Configuration
            var container = new WindsorContainer();

            Bootstrapper.WireUp(container);

            UserManagementBootstrapper.Wireup(container, connectionString);
            var service = new WindsorServiceResolver(services, container).GetServiceProvider();

            return(service);
        }
Exemplo n.º 2
0
 private static void WireupBoundedContexts(WindsorContainer container, string connectionString)
 {
     UserManagementBootstrapper.Wireup(container, connectionString);
     FrameworkBootstrapper.WireUp(container);
 }