28 lines
1.1 KiB
C#
28 lines
1.1 KiB
C#
using Microsoft.AspNetCore.Components.Authorization;
|
|
using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
|
|
using MudBlazor.Services;
|
|
using timetracker.Client.Services;
|
|
using timetracker.Shared;
|
|
|
|
var builder = WebAssemblyHostBuilder.CreateDefault(args);
|
|
|
|
builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) });
|
|
|
|
builder.Services.AddMudServices();
|
|
|
|
builder.Services.AddAuthorizationCore(options =>
|
|
{
|
|
options.AddPolicy("AdminOnly", policy =>
|
|
policy.RequireClaim(System.Security.Claims.ClaimTypes.Name, "marc"));
|
|
});
|
|
|
|
builder.Services.AddScoped<HostAuthenticationStateProvider>();
|
|
builder.Services.AddScoped<AuthenticationStateProvider>(sp => sp.GetRequiredService<HostAuthenticationStateProvider>());
|
|
|
|
builder.Services.AddScoped<IAuthService, ClientAuthService>();
|
|
builder.Services.AddScoped<ITimetrackerService, ClientTimetrackerService>();
|
|
builder.Services.AddScoped<IHolidayService, ClientHolidayService>();
|
|
builder.Services.AddScoped<IUserNotificationService, UserNotificationService>();
|
|
|
|
await builder.Build().RunAsync();
|