-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProgram.cs
102 lines (86 loc) · 3.7 KB
/
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
using Blazored.LocalStorage;
using Client.Infrastructure;
using Client.Services;
using Fluxor;
using Material.Blazor;
using Microsoft.AspNetCore.Components.WebAssembly.Authentication;
using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Radzen;
using System;
using System.Net.Http;
using System.Threading.Tasks;
namespace Client
{
public class Program
{
public static async Task Main(string[] args)
{
var builder = WebAssemblyHostBuilder.CreateDefault(args);
builder.RootComponents.Add<App>("#app");
builder.Services.AddOidcAuthentication(options =>
{
builder.Configuration.Bind("Local", options.ProviderOptions);
options.AuthenticationPaths.LogInPath = "http:/localhost:6001/api/v1/account/login";
options.AuthenticationPaths.LogOutPath = "http:/localhost:6001/api/v1/account/logout";
});
builder.Services.AddAutoMapper(typeof(Program));
builder.Services.AddFluxor(options =>
{
options.ScanAssemblies(typeof(Program).Assembly);
options.UseReduxDevTools();
});
builder.Services.AddMBServices(
toastServiceConfiguration: new MBToastServiceConfiguration()
{
InfoDefaultHeading = "Info",
SuccessDefaultHeading = "Success",
WarningDefaultHeading = "Warning",
ErrorDefaultHeading = "Error",
Timeout = 3000,
MaxToastsShowing = 5,
Position = MBToastPosition.TopRight
},
animatedNavigationManagerServiceConfiguration: new MBAnimatedNavigationManagerServiceConfiguration()
{
ApplyAnimation = true,
AnimationTime = 300
},
snackbarServiceConfiguration: new MBSnackbarServiceConfiguration()
{
CloseMethod = MBNotifierCloseMethod.TimeoutAndDismissButton,
Leading = false,
Stacked = false,
Timeout = 5000
}
);
builder.Services.AddSingleton<DragAndDropService>();
builder.Services.AddScoped<DialogService>();
builder.Services.AddScoped<NotificationService>();
builder.Services.AddBlazoredLocalStorage();
builder.Services.AddScoped<CourseService>();
builder.Services.AddScoped<ArticleService>();
builder.Services.AddScoped<WorkbanchService>();
builder.Services.AddScoped<SupportService>();
builder.Services.AddHttpClient("api")
.AddHttpMessageHandler(sp =>
{
var handler = sp.GetService<AuthorizationMessageHandler>()
.ConfigureHandler(
authorizedUrls: new[] { "https://localhost:7001" },
scopes: new[] { "CourseAPI" });
return handler;
});
builder.Services.AddScoped(sp => sp.GetService<IHttpClientFactory>().CreateClient("api"));
builder.Services
.AddOidcAuthentication(options =>
{
builder.Configuration.Bind("oidc", options.ProviderOptions);
//options.UserOptions.RoleClaim = "role";
});
//builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri("https://localhost/") });
await builder.Build().RunAsync();
}
}
}