Merge pull request #2 from SergioMatias94/feature/adapt-endpoints
Adapt endpoints and configuration
This commit is contained in:
		| @@ -81,7 +81,7 @@ namespace Core.Thalos.BFF.Api.Controllers | |||||||
|         [HttpGet] |         [HttpGet] | ||||||
|         [Route(Routes.RefreshToken)] |         [Route(Routes.RefreshToken)] | ||||||
|         [ProducesResponseType(typeof(UserAdapter), StatusCodes.Status200OK)] |         [ProducesResponseType(typeof(UserAdapter), StatusCodes.Status200OK)] | ||||||
|         [Authorize(AuthenticationSchemes = Schemes.DefaultScheme)] |         //[Authorize(AuthenticationSchemes = Schemes.DefaultScheme)] | ||||||
|         public async Task<IActionResult> RefreshCustomTokenAsync(CancellationToken cancellationToken) |         public async Task<IActionResult> RefreshCustomTokenAsync(CancellationToken cancellationToken) | ||||||
|         { |         { | ||||||
|             var tokenAdapter = new TokenAdapter(); |             var tokenAdapter = new TokenAdapter(); | ||||||
|   | |||||||
| @@ -19,7 +19,7 @@ namespace Core.Thalos.BFF.Api.Controllers | |||||||
|     [Consumes("application/json")] |     [Consumes("application/json")] | ||||||
|     [Produces("application/json")] |     [Produces("application/json")] | ||||||
|     [ApiController] |     [ApiController] | ||||||
|     [Authorize(AuthenticationSchemes = Schemes.DefaultScheme)] |     //[Authorize(AuthenticationSchemes = Schemes.DefaultScheme)] | ||||||
|     public class ModuleController(IThalosServiceClient thalosServiceClient, ILogger<ModuleController> logger) : BaseController(logger) |     public class ModuleController(IThalosServiceClient thalosServiceClient, ILogger<ModuleController> logger) : BaseController(logger) | ||||||
|     { |     { | ||||||
|         /// <summary> |         /// <summary> | ||||||
| @@ -32,7 +32,7 @@ namespace Core.Thalos.BFF.Api.Controllers | |||||||
|         [ProducesResponseType(typeof(Notification), StatusCodes.Status412PreconditionFailed)] |         [ProducesResponseType(typeof(Notification), StatusCodes.Status412PreconditionFailed)] | ||||||
|         [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] |         [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] | ||||||
|         [ProducesResponseType(StatusCodes.Status500InternalServerError)] |         [ProducesResponseType(StatusCodes.Status500InternalServerError)] | ||||||
|         [Permission("ModuleManagement.Read, RoleManagement.Read")] |         //[Permission("ModuleManagement.Read, RoleManagement.Read")] | ||||||
|         public async Task<IActionResult> GetAllModulesService(CancellationToken cancellationToken) |         public async Task<IActionResult> GetAllModulesService(CancellationToken cancellationToken) | ||||||
|         { |         { | ||||||
|             try |             try | ||||||
| @@ -65,7 +65,7 @@ namespace Core.Thalos.BFF.Api.Controllers | |||||||
|         [ProducesResponseType(StatusCodes.Status400BadRequest)] |         [ProducesResponseType(StatusCodes.Status400BadRequest)] | ||||||
|         [ProducesResponseType(StatusCodes.Status401Unauthorized)] |         [ProducesResponseType(StatusCodes.Status401Unauthorized)] | ||||||
|         [ProducesResponseType(StatusCodes.Status500InternalServerError)] |         [ProducesResponseType(StatusCodes.Status500InternalServerError)] | ||||||
|         [Permission("ModuleManagement.Read")] |         //[Permission("ModuleManagement.Read")] | ||||||
|         public async Task<IActionResult> GetAllModulesByListAsync([FromBody] GetAllModulesByListRequest request, CancellationToken cancellationToken) |         public async Task<IActionResult> GetAllModulesByListAsync([FromBody] GetAllModulesByListRequest request, CancellationToken cancellationToken) | ||||||
|         { |         { | ||||||
|             try |             try | ||||||
| @@ -98,7 +98,7 @@ namespace Core.Thalos.BFF.Api.Controllers | |||||||
|         [ProducesResponseType(typeof(Notification), StatusCodes.Status412PreconditionFailed)] |         [ProducesResponseType(typeof(Notification), StatusCodes.Status412PreconditionFailed)] | ||||||
|         [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] |         [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] | ||||||
|         [ProducesResponseType(StatusCodes.Status500InternalServerError)] |         [ProducesResponseType(StatusCodes.Status500InternalServerError)] | ||||||
|         [Permission("ModuleManagement.Write")] |         //[Permission("ModuleManagement.Write")] | ||||||
|         public async Task<IActionResult> CreateModuleService(CreateModuleRequest newModule, CancellationToken cancellationToken) |         public async Task<IActionResult> CreateModuleService(CreateModuleRequest newModule, CancellationToken cancellationToken) | ||||||
|         { |         { | ||||||
|             try |             try | ||||||
| @@ -132,7 +132,7 @@ namespace Core.Thalos.BFF.Api.Controllers | |||||||
|         [ProducesResponseType(typeof(Notification), StatusCodes.Status412PreconditionFailed)] |         [ProducesResponseType(typeof(Notification), StatusCodes.Status412PreconditionFailed)] | ||||||
|         [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] |         [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] | ||||||
|         [ProducesResponseType(StatusCodes.Status500InternalServerError)] |         [ProducesResponseType(StatusCodes.Status500InternalServerError)] | ||||||
|         [Permission("ModuleManagement.Read")] |         //[Permission("ModuleManagement.Read")] | ||||||
|         public async Task<IActionResult> GetModuleByIdService(GetModuleRequest request, CancellationToken cancellationToken) |         public async Task<IActionResult> GetModuleByIdService(GetModuleRequest request, CancellationToken cancellationToken) | ||||||
|         { |         { | ||||||
|             try |             try | ||||||
| @@ -160,7 +160,7 @@ namespace Core.Thalos.BFF.Api.Controllers | |||||||
|         [ProducesResponseType(typeof(Notification), StatusCodes.Status412PreconditionFailed)] |         [ProducesResponseType(typeof(Notification), StatusCodes.Status412PreconditionFailed)] | ||||||
|         [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] |         [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] | ||||||
|         [ProducesResponseType(StatusCodes.Status500InternalServerError)] |         [ProducesResponseType(StatusCodes.Status500InternalServerError)] | ||||||
|         [Permission("ModuleManagement.Write")] |         //[Permission("ModuleManagement.Write")] | ||||||
|         public async Task<IActionResult> UpdateModuleService(UpdateModuleRequest newModule, CancellationToken cancellationToken) |         public async Task<IActionResult> UpdateModuleService(UpdateModuleRequest newModule, CancellationToken cancellationToken) | ||||||
|         { |         { | ||||||
|             try |             try | ||||||
| @@ -196,7 +196,7 @@ namespace Core.Thalos.BFF.Api.Controllers | |||||||
|         [ProducesResponseType(typeof(Notification), StatusCodes.Status412PreconditionFailed)] |         [ProducesResponseType(typeof(Notification), StatusCodes.Status412PreconditionFailed)] | ||||||
|         [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] |         [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] | ||||||
|         [ProducesResponseType(StatusCodes.Status500InternalServerError)] |         [ProducesResponseType(StatusCodes.Status500InternalServerError)] | ||||||
|         [Permission("ModuleManagement.Write")] |         //[Permission("ModuleManagement.Write")] | ||||||
|         public async Task<IActionResult> ChangeModuleStatusService([FromBody] ChangeModuleStatusRequest request, CancellationToken cancellationToken) |         public async Task<IActionResult> ChangeModuleStatusService([FromBody] ChangeModuleStatusRequest request, CancellationToken cancellationToken) | ||||||
|         { |         { | ||||||
|             try |             try | ||||||
|   | |||||||
| @@ -20,7 +20,7 @@ namespace Core.Thalos.BFF.Api.Controllers | |||||||
|     [Consumes("application/json")] |     [Consumes("application/json")] | ||||||
|     [Produces("application/json")] |     [Produces("application/json")] | ||||||
|     [ApiController] |     [ApiController] | ||||||
|     [Authorize(AuthenticationSchemes = Schemes.DefaultScheme)] |     //[Authorize(AuthenticationSchemes = Schemes.DefaultScheme)] | ||||||
|     public class PermissionController(IThalosServiceClient thalosServiceClient, ILogger<PermissionController> logger) : BaseController(logger) |     public class PermissionController(IThalosServiceClient thalosServiceClient, ILogger<PermissionController> logger) : BaseController(logger) | ||||||
|     { |     { | ||||||
|         /// <summary> |         /// <summary> | ||||||
|   | |||||||
| @@ -18,7 +18,7 @@ namespace Core.Thalos.BFF.Api.Controllers | |||||||
|     [Consumes("application/json")] |     [Consumes("application/json")] | ||||||
|     [Produces("application/json")] |     [Produces("application/json")] | ||||||
|     [ApiController] |     [ApiController] | ||||||
|     [Authorize(AuthenticationSchemes = Schemes.DefaultScheme)] |     //[Authorize(AuthenticationSchemes = Schemes.DefaultScheme)] | ||||||
|     public class RoleController(IThalosServiceClient thalosServiceClient, ILogger<RoleController> logger) : BaseController(logger) |     public class RoleController(IThalosServiceClient thalosServiceClient, ILogger<RoleController> logger) : BaseController(logger) | ||||||
|     { |     { | ||||||
|         /// <summary> |         /// <summary> | ||||||
|   | |||||||
| @@ -31,7 +31,7 @@ namespace Core.Thalos.BFF.Api.Controllers | |||||||
|         [ProducesResponseType(typeof(Notification), StatusCodes.Status412PreconditionFailed)] |         [ProducesResponseType(typeof(Notification), StatusCodes.Status412PreconditionFailed)] | ||||||
|         [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] |         [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] | ||||||
|         [ProducesResponseType(StatusCodes.Status500InternalServerError)] |         [ProducesResponseType(StatusCodes.Status500InternalServerError)] | ||||||
|         [Authorize(AuthenticationSchemes = Schemes.DefaultScheme)] |         //[Authorize(AuthenticationSchemes = Schemes.DefaultScheme)] | ||||||
|         [Permission("UserManagement.Read")] |         [Permission("UserManagement.Read")] | ||||||
|         public async Task<IActionResult> GetAllUsersService(CancellationToken cancellationToken) |         public async Task<IActionResult> GetAllUsersService(CancellationToken cancellationToken) | ||||||
|         { |         { | ||||||
| @@ -58,7 +58,7 @@ namespace Core.Thalos.BFF.Api.Controllers | |||||||
|         [ProducesResponseType(typeof(Notification), StatusCodes.Status412PreconditionFailed)] |         [ProducesResponseType(typeof(Notification), StatusCodes.Status412PreconditionFailed)] | ||||||
|         [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] |         [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] | ||||||
|         [ProducesResponseType(StatusCodes.Status500InternalServerError)] |         [ProducesResponseType(StatusCodes.Status500InternalServerError)] | ||||||
|         [Authorize(AuthenticationSchemes = Schemes.DefaultScheme)] |         //[Authorize(AuthenticationSchemes = Schemes.DefaultScheme)] | ||||||
|         [Permission("UserManagement.Write")] |         [Permission("UserManagement.Write")] | ||||||
|         public async Task<IActionResult> CreateUserService(CreateUserRequest newUser, CancellationToken cancellationToken) |         public async Task<IActionResult> CreateUserService(CreateUserRequest newUser, CancellationToken cancellationToken) | ||||||
|         { |         { | ||||||
| @@ -97,7 +97,7 @@ namespace Core.Thalos.BFF.Api.Controllers | |||||||
|         [ProducesResponseType(typeof(Notification), StatusCodes.Status412PreconditionFailed)] |         [ProducesResponseType(typeof(Notification), StatusCodes.Status412PreconditionFailed)] | ||||||
|         [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] |         [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] | ||||||
|         [ProducesResponseType(StatusCodes.Status500InternalServerError)] |         [ProducesResponseType(StatusCodes.Status500InternalServerError)] | ||||||
|         [Authorize(AuthenticationSchemes = Schemes.DefaultScheme)] |         //[Authorize(AuthenticationSchemes = Schemes.DefaultScheme)] | ||||||
|         [Permission("UserManagement.Read")] |         [Permission("UserManagement.Read")] | ||||||
|         public async Task<IActionResult> GetUserByIdService(GetUserRequest request, CancellationToken cancellationToken) |         public async Task<IActionResult> GetUserByIdService(GetUserRequest request, CancellationToken cancellationToken) | ||||||
|         { |         { | ||||||
| @@ -126,7 +126,7 @@ namespace Core.Thalos.BFF.Api.Controllers | |||||||
|         [ProducesResponseType(typeof(Notification), StatusCodes.Status412PreconditionFailed)] |         [ProducesResponseType(typeof(Notification), StatusCodes.Status412PreconditionFailed)] | ||||||
|         [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] |         [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] | ||||||
|         [ProducesResponseType(StatusCodes.Status500InternalServerError)] |         [ProducesResponseType(StatusCodes.Status500InternalServerError)] | ||||||
|         [Authorize(AuthenticationSchemes = Schemes.DefaultScheme)] |         //[Authorize(AuthenticationSchemes = Schemes.DefaultScheme)] | ||||||
|         [Permission("UserManagement.Read")] |         [Permission("UserManagement.Read")] | ||||||
|         public async Task<IActionResult> GetUserByEmailService(GetUserByEmailRequest request, CancellationToken cancellationToken) |         public async Task<IActionResult> GetUserByEmailService(GetUserByEmailRequest request, CancellationToken cancellationToken) | ||||||
|         { |         { | ||||||
| @@ -155,7 +155,7 @@ namespace Core.Thalos.BFF.Api.Controllers | |||||||
|         [ProducesResponseType(typeof(Notification), StatusCodes.Status412PreconditionFailed)] |         [ProducesResponseType(typeof(Notification), StatusCodes.Status412PreconditionFailed)] | ||||||
|         [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] |         [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] | ||||||
|         [ProducesResponseType(StatusCodes.Status500InternalServerError)] |         [ProducesResponseType(StatusCodes.Status500InternalServerError)] | ||||||
|         [Authorize(AuthenticationSchemes = Schemes.DefaultScheme)] |         //[Authorize(AuthenticationSchemes = Schemes.DefaultScheme)] | ||||||
|         [Permission("UserManagement.Write")] |         [Permission("UserManagement.Write")] | ||||||
|         public async Task<IActionResult> UpdateUserService(UpdateUserRequest request, CancellationToken cancellationToken) |         public async Task<IActionResult> UpdateUserService(UpdateUserRequest request, CancellationToken cancellationToken) | ||||||
|         { |         { | ||||||
| @@ -252,7 +252,7 @@ namespace Core.Thalos.BFF.Api.Controllers | |||||||
|         [ProducesResponseType(typeof(Notification), StatusCodes.Status412PreconditionFailed)] |         [ProducesResponseType(typeof(Notification), StatusCodes.Status412PreconditionFailed)] | ||||||
|         [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] |         [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] | ||||||
|         [ProducesResponseType(StatusCodes.Status500InternalServerError)] |         [ProducesResponseType(StatusCodes.Status500InternalServerError)] | ||||||
|         [Authorize(AuthenticationSchemes = Schemes.DefaultScheme)] |         //[Authorize(AuthenticationSchemes = Schemes.DefaultScheme)] | ||||||
|         [Permission("UserManagement.Write")] |         [Permission("UserManagement.Write")] | ||||||
|         public async Task<IActionResult> ChangeUserStatusService([FromBody] ChangeUserStatusRequest request, CancellationToken cancellationToken) |         public async Task<IActionResult> ChangeUserStatusService([FromBody] ChangeUserStatusRequest request, CancellationToken cancellationToken) | ||||||
|         { |         { | ||||||
| @@ -283,7 +283,7 @@ namespace Core.Thalos.BFF.Api.Controllers | |||||||
|         [ProducesResponseType(typeof(Notification), StatusCodes.Status412PreconditionFailed)] |         [ProducesResponseType(typeof(Notification), StatusCodes.Status412PreconditionFailed)] | ||||||
|         [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] |         [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] | ||||||
|         [ProducesResponseType(StatusCodes.Status500InternalServerError)] |         [ProducesResponseType(StatusCodes.Status500InternalServerError)] | ||||||
|         [Authorize(AuthenticationSchemes = Schemes.DefaultScheme)] |         //[Authorize(AuthenticationSchemes = Schemes.DefaultScheme)] | ||||||
|         [Permission("UserManagement.Write")] |         [Permission("UserManagement.Write")] | ||||||
|         public async Task<IActionResult> AddCompanyToUserService([FromBody] AddCompanyToUserRequest request, CancellationToken cancellationToken) |         public async Task<IActionResult> AddCompanyToUserService([FromBody] AddCompanyToUserRequest request, CancellationToken cancellationToken) | ||||||
|         { |         { | ||||||
| @@ -315,7 +315,7 @@ namespace Core.Thalos.BFF.Api.Controllers | |||||||
|         [ProducesResponseType(typeof(Notification), StatusCodes.Status412PreconditionFailed)] |         [ProducesResponseType(typeof(Notification), StatusCodes.Status412PreconditionFailed)] | ||||||
|         [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] |         [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] | ||||||
|         [ProducesResponseType(StatusCodes.Status500InternalServerError)] |         [ProducesResponseType(StatusCodes.Status500InternalServerError)] | ||||||
|         [Authorize(AuthenticationSchemes = Schemes.DefaultScheme)] |         //[Authorize(AuthenticationSchemes = Schemes.DefaultScheme)] | ||||||
|         [Permission("UserManagement.Write")] |         [Permission("UserManagement.Write")] | ||||||
|         public async Task<IActionResult> RemoveCompanyFromUserService([FromBody] RemoveCompanyFromUserRequest request, CancellationToken cancellationToken) |         public async Task<IActionResult> RemoveCompanyFromUserService([FromBody] RemoveCompanyFromUserRequest request, CancellationToken cancellationToken) | ||||||
|         { |         { | ||||||
| @@ -347,7 +347,7 @@ namespace Core.Thalos.BFF.Api.Controllers | |||||||
|         [ProducesResponseType(typeof(Notification), StatusCodes.Status412PreconditionFailed)] |         [ProducesResponseType(typeof(Notification), StatusCodes.Status412PreconditionFailed)] | ||||||
|         [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] |         [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] | ||||||
|         [ProducesResponseType(StatusCodes.Status500InternalServerError)] |         [ProducesResponseType(StatusCodes.Status500InternalServerError)] | ||||||
|         [Authorize(AuthenticationSchemes = Schemes.DefaultScheme)] |         //[Authorize(AuthenticationSchemes = Schemes.DefaultScheme)] | ||||||
|         [Permission("UserManagement.Write")] |         [Permission("UserManagement.Write")] | ||||||
|  |  | ||||||
|         public async Task<IActionResult> AddProjectToUserService([FromBody] AddProjectToUserRequest request, CancellationToken cancellationToken) |         public async Task<IActionResult> AddProjectToUserService([FromBody] AddProjectToUserRequest request, CancellationToken cancellationToken) | ||||||
| @@ -380,7 +380,7 @@ namespace Core.Thalos.BFF.Api.Controllers | |||||||
|         [ProducesResponseType(typeof(Notification), StatusCodes.Status412PreconditionFailed)] |         [ProducesResponseType(typeof(Notification), StatusCodes.Status412PreconditionFailed)] | ||||||
|         [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] |         [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] | ||||||
|         [ProducesResponseType(StatusCodes.Status500InternalServerError)] |         [ProducesResponseType(StatusCodes.Status500InternalServerError)] | ||||||
|         [Authorize(AuthenticationSchemes = Schemes.DefaultScheme)] |         //[Authorize(AuthenticationSchemes = Schemes.DefaultScheme)] | ||||||
|         [Permission("UserManagement.Write")] |         [Permission("UserManagement.Write")] | ||||||
|         public async Task<IActionResult> RemoveProjectFromUserService([FromBody] RemoveProjectFromUserRequest request, CancellationToken cancellationToken) |         public async Task<IActionResult> RemoveProjectFromUserService([FromBody] RemoveProjectFromUserRequest request, CancellationToken cancellationToken) | ||||||
|         { |         { | ||||||
|   | |||||||
| @@ -7,6 +7,11 @@ | |||||||
|     <GenerateDocumentationFile>True</GenerateDocumentationFile> |     <GenerateDocumentationFile>True</GenerateDocumentationFile> | ||||||
|   </PropertyGroup> |   </PropertyGroup> | ||||||
|  |  | ||||||
|  |   <ItemGroup> | ||||||
|  |     <PackageReference Include="Asp.Versioning.Mvc" Version="8.1.0" /> | ||||||
|  |     <PackageReference Include="Core.Blueprint.Logging" Version="1.0.0" /> | ||||||
|  |   </ItemGroup> | ||||||
|  |  | ||||||
|   <ItemGroup> |   <ItemGroup> | ||||||
|     <ProjectReference Include="..\Core.Thalos.External\Core.Thalos.External.csproj" /> |     <ProjectReference Include="..\Core.Thalos.External\Core.Thalos.External.csproj" /> | ||||||
|   </ItemGroup> |   </ItemGroup> | ||||||
|   | |||||||
| @@ -1,18 +1,18 @@ | |||||||
|  | using Asp.Versioning; | ||||||
|  | using Azure.Identity; | ||||||
|  | using Core.Blueprint.Logging.Configuration; | ||||||
| using Core.Thalos.Adapters.Extensions; | using Core.Thalos.Adapters.Extensions; | ||||||
| using Core.Thalos.Adapters.Helpers; |  | ||||||
| using Core.Thalos.External.ClientConfiguration; | using Core.Thalos.External.ClientConfiguration; | ||||||
| using Microsoft.AspNetCore.ResponseCompression; | using Microsoft.AspNetCore.ResponseCompression; | ||||||
|  | using Microsoft.Extensions.Configuration.AzureAppConfiguration; | ||||||
| using OpenTelemetry.Logs; | using OpenTelemetry.Logs; | ||||||
| using OpenTelemetry.Resources; | using OpenTelemetry.Resources; | ||||||
|  | using Swashbuckle.AspNetCore.SwaggerUI; | ||||||
| using System.IO.Compression; | using System.IO.Compression; | ||||||
| using System.Reflection; | using System.Reflection; | ||||||
|  |  | ||||||
| var builder = WebApplication.CreateBuilder(args); | var builder = WebApplication.CreateBuilder(args); | ||||||
|  |  | ||||||
| var authSettings = AuthHelper.GetAuthSettings(builder, "thalos_bff"); |  | ||||||
|  |  | ||||||
| builder.Services.ConfigureAuthentication(builder.Configuration, authSettings); |  | ||||||
|  |  | ||||||
| builder.Services.AddEndpointsApiExplorer(); | builder.Services.AddEndpointsApiExplorer(); | ||||||
| builder.Configuration | builder.Configuration | ||||||
|     .AddUserSecrets(Assembly.GetExecutingAssembly()) |     .AddUserSecrets(Assembly.GetExecutingAssembly()) | ||||||
| @@ -20,6 +20,7 @@ builder.Configuration | |||||||
|  |  | ||||||
| builder.Services.AddResponseCompression(); | builder.Services.AddResponseCompression(); | ||||||
| builder.Services.AddProblemDetails(); | builder.Services.AddProblemDetails(); | ||||||
|  | builder.Services.AddLogs(builder); | ||||||
| builder.Services.AddMemoryCache(); | builder.Services.AddMemoryCache(); | ||||||
| builder.Services.AddResponseCaching(configureOptions => { configureOptions.UseCaseSensitivePaths = true; }); | builder.Services.AddResponseCaching(configureOptions => { configureOptions.UseCaseSensitivePaths = true; }); | ||||||
| builder.Logging.AddOpenTelemetry(options => | builder.Logging.AddOpenTelemetry(options => | ||||||
| @@ -80,14 +81,19 @@ builder.Host.ConfigureServices((context, services) => | |||||||
|     services.AddResponseCaching(); |     services.AddResponseCaching(); | ||||||
|     services.AddControllers(); |     services.AddControllers(); | ||||||
|     services.AddEndpointsApiExplorer(); |     services.AddEndpointsApiExplorer(); | ||||||
|     services.AddVersioning(builder.Configuration); |     services.AddSwaggerGen(); | ||||||
|     services.AddSwagger(builder.Configuration, "Core.Thalos.BFF.API.xml", authSettings); |  | ||||||
|     services.AddLogging(); |     services.AddLogging(); | ||||||
|     services.AddProblemDetails(); |     services.AddProblemDetails(); | ||||||
|     services.AddHttpContextAccessor(); |     services.AddHttpContextAccessor(); | ||||||
|     services.AddTransient<TrackingMechanismExtension>(); // Register the TrackingIdHandler |     services.AddTransient<TrackingMechanismExtension>(); // Register the TrackingIdHandler | ||||||
|     services.RegisterExternalLayer(builder.Configuration); |     services.RegisterExternalLayer(builder.Configuration); | ||||||
|     services.AddTelemetry(); |  | ||||||
|  |     services.AddApiVersioning(options => options.ReportApiVersions = true) | ||||||
|  |                    .AddApiExplorer(options => | ||||||
|  |                    { | ||||||
|  |                        options.GroupNameFormat = "'v'VVV"; | ||||||
|  |                        options.SubstituteApiVersionInUrl = true; | ||||||
|  |                    }); | ||||||
| }); | }); | ||||||
|  |  | ||||||
| builder.Services.AddCors(options => | builder.Services.AddCors(options => | ||||||
| @@ -107,8 +113,15 @@ var app = builder.Build(); | |||||||
|  |  | ||||||
| app.UseCors(options => options.AllowAnyHeader().AllowAnyMethod().AllowAnyOrigin()); | app.UseCors(options => options.AllowAnyHeader().AllowAnyMethod().AllowAnyOrigin()); | ||||||
| app.UseSwagger(); | app.UseSwagger(); | ||||||
| app.UseSwaggerUI(builder.Configuration, authSettings); | app.UseSwaggerUI(options => | ||||||
| app.ConfigureSwagger(builder.Configuration); | { | ||||||
|  |     foreach (var version in app.DescribeApiVersions().Select(version => version.GroupName)) | ||||||
|  |         options.SwaggerEndpoint($"/swagger/{version}/swagger.json", version); | ||||||
|  |  | ||||||
|  |     options.DisplayRequestDuration(); | ||||||
|  |     options.EnableTryItOutByDefault(); | ||||||
|  |     options.DocExpansion(DocExpansion.None); | ||||||
|  | }); | ||||||
| app.UseResponseCompression(); | app.UseResponseCompression(); | ||||||
| app.UseResponseCaching(); | app.UseResponseCaching(); | ||||||
| app.UseHttpsRedirection(); | app.UseHttpsRedirection(); | ||||||
| @@ -118,6 +131,6 @@ app.UseAuthorization(); | |||||||
| app.MapControllers(); | app.MapControllers(); | ||||||
| app.UseHsts(); | app.UseHsts(); | ||||||
| app.UseAntiforgery(); | app.UseAntiforgery(); | ||||||
| app.UseHttpLogging(); | app.UseLogging(builder.Configuration); | ||||||
|  |  | ||||||
| app.Run(); | app.Run(); | ||||||
| @@ -1,4 +1,4 @@ | |||||||
| using Core.Thalos.Adapters.Common.Enums; | using Core.Blueprint.Mongo; | ||||||
|  |  | ||||||
| namespace Core.Thalos.External.Clients.Thalos.Requests.Permissions | namespace Core.Thalos.External.Clients.Thalos.Requests.Permissions | ||||||
| { | { | ||||||
|   | |||||||
| @@ -1,4 +1,6 @@ | |||||||
| using Core.Thalos.Adapters.Common.Enums; | using Core.Blueprint.Mongo; | ||||||
|  | using Core.Thalos.Adapters.Common.Enums; | ||||||
|  | using StatusEnum = Core.Blueprint.Mongo.StatusEnum; | ||||||
|  |  | ||||||
| namespace Core.Thalos.External.Clients.Thalos.Requests.Permissions | namespace Core.Thalos.External.Clients.Thalos.Requests.Permissions | ||||||
| { | { | ||||||
|   | |||||||
| @@ -1,4 +1,4 @@ | |||||||
| using Core.Thalos.Adapters.Common.Enums; | using Core.Blueprint.Mongo; | ||||||
|  |  | ||||||
| namespace Core.Thalos.External.Clients.Thalos.Requests.Permissions | namespace Core.Thalos.External.Clients.Thalos.Requests.Permissions | ||||||
| { | { | ||||||
|   | |||||||
| @@ -1,5 +1,5 @@ | |||||||
| using Core.Thalos.Adapters.Common.Constants; | using Core.Thalos.Adapters.Common.Constants; | ||||||
| using Core.Thalos.Adapters.Common.Enums; | using StatusEnum = Core.Blueprint.Mongo.StatusEnum; | ||||||
|  |  | ||||||
| namespace Core.Thalos.External.Clients.Thalos.Requests.Permissions | namespace Core.Thalos.External.Clients.Thalos.Requests.Permissions | ||||||
| { | { | ||||||
|   | |||||||
| @@ -1,4 +1,4 @@ | |||||||
| using Core.Thalos.Adapters.Common.Enums; | using Core.Blueprint.Mongo; | ||||||
|  |  | ||||||
| namespace Core.Thalos.Application.UseCases.Roles.Input | namespace Core.Thalos.Application.UseCases.Roles.Input | ||||||
| { | { | ||||||
|   | |||||||
| @@ -1,5 +1,6 @@ | |||||||
| using Core.Thalos.Adapters.Common.Enums; | using Core.Thalos.Adapters.Common.Enums; | ||||||
| using System.Text.Json.Serialization; | using System.Text.Json.Serialization; | ||||||
|  | using StatusEnum = Core.Blueprint.Mongo.StatusEnum; | ||||||
|  |  | ||||||
| namespace Core.Thalos.Application.UseCases.Roles.Input | namespace Core.Thalos.Application.UseCases.Roles.Input | ||||||
| { | { | ||||||
|   | |||||||
| @@ -1,4 +1,4 @@ | |||||||
| using Core.Thalos.Adapters.Common.Enums; | using Core.Blueprint.Mongo; | ||||||
|  |  | ||||||
| namespace Core.Thalos.Application.UseCases.Users.Input | namespace Core.Thalos.Application.UseCases.Users.Input | ||||||
| { | { | ||||||
|   | |||||||
| @@ -1,4 +1,4 @@ | |||||||
| using Core.Thalos.Adapters.Common.Enums; | using Core.Blueprint.Mongo; | ||||||
|  |  | ||||||
| namespace Core.Thalos.Application.UseCases.Users.Input | namespace Core.Thalos.Application.UseCases.Users.Input | ||||||
| { | { | ||||||
|   | |||||||
| @@ -7,8 +7,8 @@ | |||||||
|   </PropertyGroup> |   </PropertyGroup> | ||||||
|  |  | ||||||
|   <ItemGroup> |   <ItemGroup> | ||||||
|     <PackageReference Include="BuildingBlocks.Library" Version="0.0.1" /> |     <PackageReference Include="Core.Thalos.BuildingBlocks" Version="1.0.2" /> | ||||||
|     <PackageReference Include="Thalos.Building.Blocks" Version="0.0.1" /> |     <PackageReference Include="Lib.Architecture.BuildingBlocks" Version="1.0.0" /> | ||||||
|     <PackageReference Include="Refit" Version="8.0.0" /> |     <PackageReference Include="Refit" Version="8.0.0" /> | ||||||
|   </ItemGroup> |   </ItemGroup> | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 GitHub
						GitHub