using BinaryDad.Notes; using BinaryDad.Notes.Services; using Microsoft.AspNetCore.Authentication.Cookies; var builder = WebApplication.CreateBuilder(args); // Add services to the container. builder.Services.AddControllersWithViews(); builder.Services.AddSignalR(); builder.Services.AddSingleton(); builder.Services.AddSession(options => { options.IdleTimeout = TimeSpan.FromMinutes(30); }); builder.Services.AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme).AddCookie(o => { o.LoginPath = "/login"; o.Cookie.MaxAge = TimeSpan.FromHours(12); }); var app = builder.Build(); // Configure the HTTP request pipeline. if (!app.Environment.IsDevelopment()) { app.UseHttpsRedirection(); } app.UseStaticFiles(); app.UseRouting(); app.UseAuthentication(); app.UseAuthorization(); app.MapControllerRoute( name: "default", pattern: "{controller=Note}/{action=Index}/{id?}"); app.MapHub("/noteHub"); app.Run();