Nie możesz wybrać więcej, niż 25 tematów
Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.
|
- using CouponReport.Models.CouponMiddleware;
- using CouponReport.Models.Parkingeyes;
- using CouponReport.Service;
- using LaneFlowReport.Auth;
- using LaneFlowReport.Options;
- using Microsoft.AspNetCore.Authentication.Cookies;
- using Microsoft.EntityFrameworkCore;
-
- var builder = WebApplication.CreateBuilder(args);
-
- builder.Services.AddHttpClient();
- builder.Services.AddScoped<ReportService>();
- builder.Services.AddSingleton<ParkingAuthProvider>();
-
- builder.Services.Configure<OauthOption>(builder.Configuration.GetSection("Authentication:Parking"));
- builder.Services.AddDbContext<CouponMiddlewareContext>(options =>
- options.UseSqlServer(builder.Configuration.GetConnectionString("myConnection")));
-
- builder.Services.AddDbContext<ParkingEyesContext>(options =>
- options.UseSqlServer(builder.Configuration.GetConnectionString("ParkingEyesConnection")));
-
- builder.Services.AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme)
- .AddCookie(options =>
- {
- options.LoginPath = "/Home/Index";
- options.AccessDeniedPath = "/Home/Index";
- options.Cookie.HttpOnly = true;
- options.Cookie.IsEssential = true;
- options.Cookie.SameSite = SameSiteMode.Strict;
- options.SlidingExpiration = true;
- options.Cookie.Expiration = null;
- });
-
- // Add services to the container.
- builder.Services.AddControllersWithViews();
- builder.Services.AddSession(options =>
- {
- options.Cookie.HttpOnly = true;
- options.Cookie.IsEssential = true;
- });
-
- var app = builder.Build();
-
- // Configure the HTTP request pipeline.
- if (!app.Environment.IsDevelopment())
- {
- app.UseExceptionHandler("/Home/Error");
- app.UseHsts();
- }
-
- app.UseHttpsRedirection();
- app.UseStaticFiles();
-
- app.UseRouting();
-
- app.UseSession();
- app.UseAuthentication();
- app.UseAuthorization();
-
- app.MapControllerRoute(
- name: "default",
- pattern: "{controller=Home}/{action=Index}/{id?}");
-
- app.Run();
|