77 lines
2.6 KiB
C#
77 lines
2.6 KiB
C#
using Blazored.LocalStorage;
|
|
using Microsoft.AspNetCore.Authentication.JwtBearer;
|
|
using Microsoft.AspNetCore.Components.Authorization;
|
|
using Microsoft.IdentityModel.Tokens;
|
|
using OrdersManagement;
|
|
using OrdersManagement.Components;
|
|
using OrdersManagement.Services;
|
|
using Syncfusion.Blazor;
|
|
using System.Text;
|
|
|
|
var builder = WebApplication.CreateBuilder(args);
|
|
|
|
string faKrosnoApiUrl = builder.Configuration["FaKrosnoApiUrl"] ?? "http://localhost:5001";
|
|
|
|
builder.Services.AddSyncfusionBlazor();
|
|
builder.Services.AddBlazorBootstrap();
|
|
builder.Services.AddBlazoredLocalStorage();
|
|
|
|
// builder.Services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)
|
|
// .AddJwtBearer(options =>
|
|
// {
|
|
// options.TokenValidationParameters = new TokenValidationParameters
|
|
// {
|
|
// ValidateIssuer = true,
|
|
// ValidateAudience = true,
|
|
// ValidateLifetime = true,
|
|
// ValidateIssuerSigningKey = true,
|
|
// ValidIssuer = builder.Configuration["Jwt:Issuer"],
|
|
// ValidAudience = builder.Configuration["Jwt:Audience"],
|
|
// IssuerSigningKey = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(builder.Configuration["Jwt:Key"] ?? string.Empty)),
|
|
// NameClaimType = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier"
|
|
// };
|
|
// });
|
|
//
|
|
builder.Services.AddAuthorizationCore();
|
|
builder.Services.AddScoped<CustomAuthenticationStateProvider>();
|
|
|
|
builder.Services.AddHttpClient("FaKrosnoApi", client =>
|
|
{
|
|
client.BaseAddress = new Uri(faKrosnoApiUrl);
|
|
client.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json"));
|
|
});
|
|
builder.Services.AddRazorComponents()
|
|
.AddInteractiveServerComponents();
|
|
|
|
builder.Services.AddScoped<ScheduleOrderService>();
|
|
builder.Services.AddScoped<EdiCustomerOrderService>();
|
|
builder.Services.AddScoped<CustomerOrderService>();
|
|
builder.Services.AddScoped<HangfireService>();
|
|
builder.Services.AddScoped<RoleService>();
|
|
builder.Services.AddScoped<FunctionService>();
|
|
builder.Services.AddScoped<UserService>();
|
|
builder.Services.AddScoped<ErrorLogService>();
|
|
|
|
var app = builder.Build();
|
|
|
|
if (!app.Environment.IsDevelopment())
|
|
{
|
|
app.UseExceptionHandler("/Error", createScopeForErrors: true);
|
|
app.UseHsts();
|
|
}
|
|
|
|
app.UseHttpsRedirection();
|
|
app.UseStaticFiles();
|
|
app.UseRouting();
|
|
|
|
app.UseAuthentication();
|
|
app.UseAuthorization();
|
|
|
|
app.UseAntiforgery();
|
|
|
|
app.MapRazorComponents<App>()
|
|
.AddInteractiveServerRenderMode();
|
|
|
|
Syncfusion.Licensing.SyncfusionLicenseProvider.RegisterLicense("Ngo9BigBOggjHTQxAR8/V1NMaF5cXmBCf1FpRmJGdld5fUVHYVZUTXxaS00DNHVRdkdmWX1ec3VWQmNYV01wWUE=");
|
|
|
|
app.Run(); |