コード例 #1
0
ファイル: Startup.cs プロジェクト: snailspeed/Merp
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.Configure <KestrelServerOptions>(options =>
            {
                options.AllowSynchronousIO = true;
            });
            services.Configure <IISServerOptions>(options =>
            {
                options.AllowSynchronousIO = true;
            });

            services.AddAuthorization();
            services.AddAuthentication("Bearer")
            .AddIdentityServerAuthentication(options =>
            {
                options.Authority            = Configuration["IdentityServerEndpoints:Authority"];
                options.RequireHttpsMetadata = true;

                options.ApiName = "merp.registry.api.public";
            });

            RegisterClientsCors(services);

            services.AddMvc(option => option.EnableEndpointRouting = false);

            services.AddHttpContextAccessor();

            services.AddSingleton(services);
            var bootstrapper = new AppBootstrapper(Configuration, services);

            bootstrapper.Configure();
        }
コード例 #2
0
ファイル: Startup.cs プロジェクト: rfosator/Merp
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.Configure <KestrelServerOptions>(options =>
            {
                options.AllowSynchronousIO = true;
            });
            services.Configure <IISServerOptions>(options =>
            {
                options.AllowSynchronousIO = true;
            });

            services.AddAuthorization();
            services.AddAuthentication("Bearer")
            .AddIdentityServerAuthentication(options =>
            {
                options.Authority            = Configuration["IdentityServerEndpoints:Authority"];
                options.RequireHttpsMetadata = true;

                options.ApiName = "merp.registry.api.public";
            });

            RegisterClientsCors(services);

            services.AddMvc(option => option.EnableEndpointRouting = true);
            services.AddSwaggerGen(c =>
            {
                c.CustomSchemaIds(type => type.ToString());
                c.SwaggerDoc("v1", new OpenApiInfo {
                    Title = "Merp public API - Registry", Version = "v1"
                });
            });
            services.AddSwaggerGenWithConventionalRoutes();

            services.AddHttpContextAccessor();

            services.AddSingleton(services);
            var bootstrapper = new AppBootstrapper(Configuration, services);

            bootstrapper.Configure();

            services.AddScoped <PersonControllerWorkerServices>();
            services.AddScoped <CompanyControllerWorkerServices>();
        }
コード例 #3
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddAuthorization();
            services.AddAuthentication("Bearer")
            .AddIdentityServerAuthentication(options =>
            {
                options.Authority            = Configuration["IdentityServerEndpoints:Authority"];
                options.RequireHttpsMetadata = true;

                options.ApiName = "merp.registry.api.public";
            });

            RegisterClientsCors(services);

            services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2);
            services.AddHttpContextAccessor();

            services.AddSingleton(services);
            var bootstrapper = new AppBootstrapper(Configuration, services);

            bootstrapper.Configure();
        }