Beispiel #1
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2);

            services.AddDbContext <UserContext>(opt =>
                                                //options.UseSqlServer(Configuration.GetConnectionString("DemoTokenContext"))
                                                opt.UseInMemoryDatabase("AUTH")
                                                );

            services.AddDefaultIdentity <IdentityUser>(options =>
            {
                options.Password.RequiredLength         = 6;
                options.Password.RequireLowercase       = false;
                options.Password.RequireUppercase       = false;
                options.Password.RequireNonAlphanumeric = false;
                options.Password.RequireDigit           = false;
            })
            //.AddRoles<IdentityRole>()
            .AddEntityFrameworkStores <UserContext>()
            .AddDefaultTokenProviders();


            services.AddCors();

            ServicoDeConfiguracaoDeAutenticacao.ConfigurarServicos(services, Configuration);
        }
Beispiel #2
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2);
            services.Add(new ServiceDescriptor(typeof(IRepositorioDePecas), new RepositorioDePecas()));
            services.AddDbContext <PecaContext>(opt => opt.UseInMemoryDatabase("PROCESSOS"));

            ServicoDeConfiguracaoDeAutenticacao.ConfigurarServicos(services, Configuration);
        }
Beispiel #3
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
                app.UseHsts();
            }

            app.UseHttpsRedirection();

            ServicoDeConfiguracaoDeAutenticacao.ConfigurarPipeline(app, env);

            app.UseMvc();
        }
Beispiel #4
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env)
        {
            app.UseCors(
                options => options.WithOrigins("http://localhost:4200")
                .AllowAnyMethod()
                .AllowAnyHeader()
                );

            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
                app.UseHsts();
            }

            app.UseHttpsRedirection();

            ServicoDeConfiguracaoDeAutenticacao.ConfigurarPipeline(app, env);

            app.UseMvc();
        }