migrare UI in WebAssembly + integrare Serviciu stocare info pe web + WebToken
This commit is contained in:
+14
-15
@@ -6,6 +6,18 @@ using Microsoft.OpenApi.Models;
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
|
||||
builder.Services.AddCors(options =>
|
||||
{
|
||||
options.AddPolicy("AllowAll",
|
||||
builder =>
|
||||
{
|
||||
builder.AllowAnyOrigin()
|
||||
.AllowAnyMethod()
|
||||
.AllowAnyHeader()
|
||||
.WithExposedHeaders("*"); // This exposes all headers
|
||||
});
|
||||
});
|
||||
|
||||
builder.Services.AddControllers();
|
||||
builder.Services.AddInfrastructureServices(builder.Configuration);
|
||||
|
||||
@@ -38,33 +50,20 @@ builder.Services.AddSwaggerGen(c =>
|
||||
|
||||
var app = builder.Build();
|
||||
|
||||
// Configure the HTTP request pipeline.
|
||||
if (app.Environment.IsDevelopment())
|
||||
{
|
||||
app.UseSwagger();
|
||||
app.UseSwaggerUI();
|
||||
}
|
||||
|
||||
app.UseCors("AllowAll");
|
||||
app.UseHttpsRedirection();
|
||||
|
||||
//builder.Services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)
|
||||
// .AddJwtBearer(options =>
|
||||
// {
|
||||
// options.TokenValidationParameters = new TokenValidationParameters
|
||||
// {
|
||||
// ValidateIssuerSigningKey = true,
|
||||
// IssuerSigningKey = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(builder.Configuration["Jwt:SecretKey"])),
|
||||
// ValidateIssuer = false,
|
||||
// ValidateAudience = false,
|
||||
// ClockSkew = TimeSpan.Zero
|
||||
// };
|
||||
// });
|
||||
|
||||
app.MapControllers();
|
||||
|
||||
// Middlewares
|
||||
app.UseMiddleware<ApiKeyMiddleware>();
|
||||
app.UseMiddleware<BodyCheckMiddleware>();
|
||||
app.UseMiddleware<JwtMiddleware>();
|
||||
|
||||
using (var scope = app.Services.CreateScope())
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user