/
gamma
/
Gamma-API
Обзор
Документация
Войти
/
gamma
/
Gamma-API
Код
Запросы
0
Пакеты
0
Релизы
0
CI/CD
Аналитика
master
GammaPlatformApi/Program.cs
53 строки
1 KB
Vlavimir Solodovnikov
Add Entities, repositories and services
11 июн 2022, 00:57
11 июн 2022, 00:57
c3562f4
Код
Авторство
О чём код?
using Gamma.Data.EF; using Gamma.Utils; using Microsoft.AspNetCore.Authentication.JwtBearer; using Microsoft.IdentityModel.Tokens; var builder = WebApplication.CreateBuilder(args); // Add services to the container. builder.Services.AddControllers(); builder.Services.AddDbContext<GammaDbContext>(); builder.Services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme) .AddJwtBearer(options => { options.RequireHttpsMetadata = true; options.TokenValidationParameters = new TokenValidationParameters { ValidateIssuer = true, ValidIssuer = AuthConfig.ISSUER, ValidateAudience = true, ValidAudience = AuthConfig.AUDIENCE, ValidateLifetime = false, ValidateIssuerSigningKey = true, IssuerSigningKey = AuthConfig.GetSymmetricSecurityKey() }; }); Gamma.Logic.Repositories.DiSetup.Setup(builder.Services); Gamma.Logic.Services.DiSetup.Setup(builder.Services); // Swagger builder.Services.AddEndpointsApiExplorer(); builder.Services.AddSwaggerGen(); var app = builder.Build(); // Configure the HTTP request pipeline. if (app.Environment.IsDevelopment()) { app.UseSwagger(); app.UseSwaggerUI(); } app.UseHttpsRedirection(); app.UseAuthentication(); app.UseAuthorization(); app.MapControllers(); app.Run();