Exemplo n.º 1
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.accountancy.api.public";
            });


            RegisterClientsCors(services);

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

            services.AddSingleton(services);

            var bootstrapper = new AppBootstrapper(Configuration, services);

            bootstrapper.Configure();

            services.AddScoped <InvoiceControllerWorkerServices>();
            services.AddScoped <JobOrderControllerWorkerServices>();
        }
Exemplo n.º 2
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.accountancy.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 - Accountancy", Version = "v1"
                });
            });
            services.AddSwaggerGenWithConventionalRoutes();

            services.AddHttpContextAccessor();

            services.AddSingleton(services);

            var bootstrapper = new AppBootstrapper(Configuration, services);

            bootstrapper.Configure();

            services.AddScoped <InvoiceControllerWorkerServices>();
            services.AddScoped <JobOrderControllerWorkerServices>();
        }