Release v1.0.0 #16
.envnuget.config
.gitea/workflows
.gitignoreApiDto
ApiDto.csproj
Backend.slnDockerfileCommon
Requests
Responses
Endpoint
Backend.http
Common
Attributes
BadRequestResponseAttribute.csLocalhostAttribute.csMaintenanceModeIgnoreAttribute.csNotFoundResponseAttribute.csSwaggerDefaultAttribute.csTokenAuthenticationAttribute.cs
Exceptions
Interfaces
Model
Services
Configuration
AppConfig
ApiVersioningConfiguration.csCacheConfiguration.csEnvironmentConfiguration.csJwtConfiguration.csLoggerConfiguration.csSecureConfiguration.csSwaggerConfiguration.cs
General
Swagger
Controllers
BaseController.cs
Endpoint.csprojConfiguration
V1
AuthController.csCampusController.csDisciplineController.csFacultyController.csGroupController.csLectureHallController.csProfessorController.csScheduleController.cs
WeatherForecastController.csMiddleware
Program.csWeatherForecast.cswwwroot/css/swagger
Security
SqlData
Application
Application.csprojDependencyInjection.cs
Common
Cqrs
Campus/Queries
GetCampusBasicInfoList
CampusBasicInfoDto.csCampusBasicInfoVm.csGetCampusBasicInfoListQuery.csGetCampusBasicInfoListQueryHandler.cs
GetCampusDetails
Discipline/Queries
GetDisciplineDetails
GetDisciplineList
Faculty/Queries
GetFacultyDetails
GetFacultyList
Group/Queries
GetGroupDetails
GetGroupList
LectureHall/Queries
GetLectureHallDetails
GetLectureHallList
Professor/Queries
GetProfessorDetails
GetProfessorList
Schedule/Queries/GetScheduleList
Interfaces/DbContexts
Domain
Domain.csproj
Schedule
Migrations
MysqlMigrations
Migrations
20240601023106_InitialMigration.Designer.cs20240601023106_InitialMigration.csUberDbContextModelSnapshot.cs
MysqlMigrations.csprojPsqlMigrations
Migrations
20240601021702_InitialMigration.Designer.cs20240601021702_InitialMigration.csUberDbContextModelSnapshot.cs
PsqlMigrations.csprojSqliteMigrations
Persistence
Common
BaseDbContext.csConfigurationResolver.csDatabaseProvider.csDbContextFactory.csModelBuilderExtensions.cs
Contexts/Schedule
CampusDbContext.csDisciplineDbContext.csFacultyDbContext.csGroupDbContext.csLectureHallDbContext.csLessonAssociationDbContext.csLessonDbContext.csProfessorDbContext.csSpecificWeekDbContext.csTypeOfOccupationDbContext.cs
DbInitializer.csDependencyInjection.csEntityTypeConfigurations
Mark.cs
Persistence.csprojUberDbContext.csMysql/Schedule
CampusConfiguration.csDisciplineConfiguration.csFacultyConfiguration.csGroupConfiguration.csLectureHallConfiguration.csLessonAssociationConfiguration.csLessonConfiguration.csProfessorConfiguration.csSpecificWeekConfiguration.csTypeOfOccupationConfiguration.cs
Postgresql/Schedule
CampusConfiguration.csDisciplineConfiguration.csFacultyConfiguration.csGroupConfiguration.csLectureHallConfiguration.csLessonAssociationConfiguration.csLessonConfiguration.csProfessorConfiguration.csSpecificWeekConfiguration.csTypeOfOccupationConfiguration.cs
Sqlite/Schedule
@ -18,6 +18,7 @@ public class GeneralConfig
|
||||
public ScheduleSettings? ScheduleSettings { get; set; }
|
||||
public EmailSettings? EmailSettings { get; set; }
|
||||
public LogSettings? LogSettings { get; set; }
|
||||
public string? SecretForwardToken { get; set; }
|
||||
|
||||
public void SaveSetting()
|
||||
{
|
||||
|
@ -1,4 +1,5 @@
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.HttpOverrides;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Options;
|
||||
@ -12,6 +13,7 @@ using Mirea.Api.Endpoint.Configuration.AppConfig;
|
||||
using Mirea.Api.Endpoint.Configuration.General;
|
||||
using Mirea.Api.Endpoint.Configuration.General.Validators;
|
||||
using Mirea.Api.Endpoint.Middleware;
|
||||
using Mirea.Api.Security.Services;
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
@ -64,6 +66,20 @@ public class Program
|
||||
});
|
||||
});
|
||||
|
||||
builder.Services.Configure<ForwardedHeadersOptions>(options =>
|
||||
{
|
||||
var secretForward = builder.Configuration.Get<GeneralConfig>();
|
||||
|
||||
if (string.IsNullOrEmpty(secretForward!.SecretForwardToken))
|
||||
{
|
||||
secretForward.SecretForwardToken = GeneratorKey.GenerateBase64(18);
|
||||
secretForward.SaveSetting();
|
||||
}
|
||||
|
||||
options.ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto;
|
||||
options.ForwardedForHeaderName = secretForward.SecretForwardToken + "-X-Forwarded-For";
|
||||
});
|
||||
|
||||
builder.Services.AddCustomApiVersioning();
|
||||
builder.Services.AddCustomSwagger();
|
||||
|
||||
@ -75,6 +91,7 @@ public class Program
|
||||
app.UseStaticFiles();
|
||||
app.UseCors("AllowAll");
|
||||
app.UseCustomSerilog();
|
||||
app.UseForwardedHeaders();
|
||||
|
||||
using (var scope = app.Services.CreateScope())
|
||||
{
|
||||
|
Reference in New Issue
Block a user