using Microsoft.AspNetCore.Authentication.Cookies; using Microsoft.AspNetCore.Components.Authorization; using OrdersManagement; using OrdersManagement.Components; using OrdersManagement.Services; using Syncfusion.Blazor; var builder = WebApplication.CreateBuilder(args); string faKrosnoApiUrl = builder.Configuration["FaKrosnoApiUrl"] ?? "http://localhost:5001"; builder.Services.AddSyncfusionBlazor(); builder.Services.AddBlazorBootstrap(); builder.Services.AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme) .AddCookie(options => { options.LoginPath = "/login"; options.LogoutPath = "/login"; }); builder.Services.AddAuthorizationCore(); builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(faKrosnoApiUrl) }); builder.Services.AddRazorComponents().AddInteractiveServerComponents(); // Usługi aplikacji builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); var app = builder.Build(); // Configure the HTTP request pipeline. if (!app.Environment.IsDevelopment()) { app.UseExceptionHandler("/Error", createScopeForErrors: true); app.UseHsts(); } app.UseHttpsRedirection(); app.UseStaticFiles(); app.UseRouting(); // Włącz autentykację i autoryzację w pipeline app.UseAuthentication(); app.UseAuthorization(); app.UseAntiforgery(); app.MapRazorComponents() .AddInteractiveServerRenderMode(); Syncfusion.Licensing.SyncfusionLicenseProvider.RegisterLicense("Ngo9BigBOggjHTQxAR8/V1NMaF5cXmBCf1FpRmJGdld5fUVHYVZUTXxaS00DNHVRdkdmWX1ec3VWQmNYV01wWUE="); app.Run();