📄
MatDenDagen/Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
using MatDenDagen; using MatDenDagen.Components; using MatDenDagen.Infrastructure.Storage; using MatDenDagen.Services; using Microsoft.AspNetCore.Authentication.Cookies; using Microsoft.AspNetCore.Builder; using Microsoft.Extensions.DependencyInjection; var builder = WebApplication.CreateBuilder(args); builder.ConfigureOpenTelemetry(); builder.Services.AddStorageServices(); builder.Services.AddRazorComponents(); builder .Services.AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme) .AddCookie(options => { options.LoginPath = "/admin/login"; options.LogoutPath = "/admin/logout"; options.AccessDeniedPath = "/admin/login"; options.Cookie.Name = "AdminAuthCookie"; }); builder.Services.AddAuthorization(); builder.Services.AddAdminService(); var app = builder.Build(); app.UseAuthentication(); app.UseAuthorization(); app.UseStatusCodePagesWithReExecute("/not-found", createScopeForStatusCodePages: true); app.MapStaticAssets(); app.MapRazorComponents<App>().DisableAntiforgery(); app.Run();