diff --git a/EWallet.Api/EWallet.Api.csproj b/EWallet.Api/EWallet.Api.csproj index 187a85b..03b027a 100644 --- a/EWallet.Api/EWallet.Api.csproj +++ b/EWallet.Api/EWallet.Api.csproj @@ -19,4 +19,8 @@ + + + + diff --git a/EWallet.Api/Program.cs b/EWallet.Api/Program.cs index 161f695..81a556e 100644 --- a/EWallet.Api/Program.cs +++ b/EWallet.Api/Program.cs @@ -1,44 +1,13 @@ var builder = WebApplication.CreateBuilder(args); -// Add services to the container. -// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle -builder.Services.AddEndpointsApiExplorer(); -builder.Services.AddSwaggerGen(); +builder.Services + .AddCustomAuthentication(builder.Configuration) + .AddCustomAuthorization(); var app = builder.Build(); -// Configure the HTTP request pipeline. -if (app.Environment.IsDevelopment()) -{ - app.UseSwagger(); - app.UseSwaggerUI(); -} - app.UseHttpsRedirection(); +app.UseAuthentication(); +app.UseAuthorization(); -var summaries = new[] -{ - "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching" -}; - -app.MapGet("/weatherforecast", () => - { - var forecast = Enumerable.Range(1, 5).Select(index => - new WeatherForecast - ( - DateOnly.FromDateTime(DateTime.Now.AddDays(index)), - Random.Shared.Next(-20, 55), - summaries[Random.Shared.Next(summaries.Length)] - )) - .ToArray(); - return forecast; - }) - .WithName("GetWeatherForecast") - .WithOpenApi(); - -app.Run(); - -record WeatherForecast(DateOnly Date, int TemperatureC, string? Summary) -{ - public int TemperatureF => 32 + (int)(TemperatureC / 0.5556); -} \ No newline at end of file +app.Run(); \ No newline at end of file