using Gotenberg.Sharp.API.Client; using Gotenberg.Sharp.API.Client.Domain.Settings; using Gotenberg.Sharp.API.Client.Extensions; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc.Authorization; using Microsoft.Identity.Web; using Microsoft.Identity.Web.UI; using Otchinslator.Components; using Otchinslator.Services; var builder = WebApplication.CreateBuilder(args); builder.Services.AddMicrosoftIdentityWebAppAuthentication(builder.Configuration); builder.Services.AddHttpContextAccessor(); builder.Services.AddControllersWithViews(options => { var policy = new AuthorizationPolicyBuilder() .RequireAuthenticatedUser() .Build(); options.Filters.Add(new AuthorizeFilter(policy)); }).AddMicrosoftIdentityUI().AddDataAnnotationsLocalization(); // Add services to the container. builder.Services.AddRazorComponents() .AddInteractiveServerComponents(); builder.Services.AddRazorPages(); ////////////// builder.Services.AddServerSideBlazor(); /////////////// builder.Services.AddOptions() .Bind(builder.Configuration.GetSection(nameof(GotenbergSharpClient))); builder.Services.AddGotenbergSharpClient(); builder.Services.AddScoped(); var app = builder.Build(); // Configure the HTTP request pipeline. if (!app.Environment.IsDevelopment()) { app.UseExceptionHandler("/Error", createScopeForErrors: true); } app.UseStaticFiles(); app.UseAntiforgery(); app.MapControllers(); app.MapRazorComponents(); // .AddInteractiveServerRenderMode(); app.Run();