Compare commits
	
		
			16 Commits
		
	
	
		
			main
			...
			f3d63ca0e3
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|   | f3d63ca0e3 | ||
|   | abcddaba9d | ||
| c1637b9e20 | |||
|   | 598081acea | ||
|   | 6d884d0d8b | ||
|   | 4d43ac70cd | ||
| 3b42b60757 | |||
| 4cea65632b | |||
| a9981b6eb3 | |||
| a09540f20a | |||
|   | 55cee7b0d3 | ||
|   | dcf801beff | ||
|   | 82ebe4408b | ||
|   | 46ebccf797 | ||
|   | 614cc00290 | ||
|   | f6595ed1df | 
| @@ -1,20 +0,0 @@ | |||||||
| <Project Sdk="Microsoft.NET.Sdk"> |  | ||||||
|  |  | ||||||
|   <PropertyGroup> |  | ||||||
|     <TargetFramework>net8.0</TargetFramework> |  | ||||||
|     <ImplicitUsings>enable</ImplicitUsings> |  | ||||||
|     <Nullable>enable</Nullable> |  | ||||||
|   </PropertyGroup> |  | ||||||
|  |  | ||||||
|   <ItemGroup> |  | ||||||
|     <PackageReference Include="Core.Blueprint.Storage" Version="0.3.0-alpha0049" /> |  | ||||||
|     <PackageReference Include="Core.Cerberos.Adapters" Version="0.3.0-alpha0042" /> |  | ||||||
|     <PackageReference Include="Lib.Architecture.BuildingBlocks" Version="0.9.0-alpha0001" /> |  | ||||||
|     <PackageReference Include="MongoDB.Driver" Version="3.1.0" /> |  | ||||||
|   </ItemGroup> |  | ||||||
|  |  | ||||||
|   <ItemGroup> |  | ||||||
|     <ProjectReference Include="..\Core.Cerberos.External\Core.Cerberos.External.csproj" /> |  | ||||||
|   </ItemGroup> |  | ||||||
|  |  | ||||||
| </Project> |  | ||||||
| @@ -1,12 +0,0 @@ | |||||||
| using Lib.Architecture.BuildingBlocks; |  | ||||||
|  |  | ||||||
| namespace Core.Cerberos.Application.UseCases.Users.Input |  | ||||||
| { |  | ||||||
|     public class AcceptUserConsentFormRequest : ICommand |  | ||||||
|     { |  | ||||||
|         public bool Validate() |  | ||||||
|         { |  | ||||||
|             return true; |  | ||||||
|         } |  | ||||||
|     } |  | ||||||
| } |  | ||||||
| @@ -1,14 +0,0 @@ | |||||||
| using Lib.Architecture.BuildingBlocks; |  | ||||||
|  |  | ||||||
| namespace Core.Cerberos.Application.UseCases.Users.Input |  | ||||||
| { |  | ||||||
|     public class AddCompanyToUserRequest : Notificator, ICommand |  | ||||||
|     { |  | ||||||
|         public string UserId { get; set; } |  | ||||||
|         public string CompanyId { get; set; } |  | ||||||
|         public bool Validate() |  | ||||||
|         { |  | ||||||
|             return true; |  | ||||||
|         } |  | ||||||
|     } |  | ||||||
| } |  | ||||||
| @@ -1,14 +0,0 @@ | |||||||
| using Lib.Architecture.BuildingBlocks; |  | ||||||
|  |  | ||||||
| namespace Core.Cerberos.Application.UseCases.Users.Input |  | ||||||
| { |  | ||||||
|     public class AddProjectToUserRequest : Notificator, ICommand |  | ||||||
|     { |  | ||||||
|         public string UserId { get; set; } |  | ||||||
|         public string ProjectId { get; set; } |  | ||||||
|         public bool Validate() |  | ||||||
|         { |  | ||||||
|             return true; |  | ||||||
|         } |  | ||||||
|     } |  | ||||||
| } |  | ||||||
| @@ -1,12 +0,0 @@ | |||||||
| using Lib.Architecture.BuildingBlocks; |  | ||||||
|  |  | ||||||
| namespace Core.Cerberos.Application.UseCases.Users.Input |  | ||||||
| { |  | ||||||
|     public class GetConsentFormPDFRequest : ICommand |  | ||||||
|     { |  | ||||||
|         public bool Validate() |  | ||||||
|         { |  | ||||||
|             return true; |  | ||||||
|         } |  | ||||||
|     } |  | ||||||
| } |  | ||||||
| @@ -1,14 +0,0 @@ | |||||||
| using Lib.Architecture.BuildingBlocks; |  | ||||||
|  |  | ||||||
| namespace Core.Cerberos.Application.UseCases.Users.Input |  | ||||||
| { |  | ||||||
|     public class RemoveCompanyFromUserRequest : Notificator, ICommand |  | ||||||
|     { |  | ||||||
|         public string UserId { get; set; } |  | ||||||
|         public string CompanyId { get; set; } |  | ||||||
|         public bool Validate() |  | ||||||
|         { |  | ||||||
|             return true; |  | ||||||
|         } |  | ||||||
|     } |  | ||||||
| } |  | ||||||
| @@ -1,14 +0,0 @@ | |||||||
| using Lib.Architecture.BuildingBlocks; |  | ||||||
|  |  | ||||||
| namespace Core.Cerberos.Application.UseCases.Users.Input |  | ||||||
| { |  | ||||||
|     public class RemoveProjectFromUserRequest : Notificator, ICommand |  | ||||||
|     { |  | ||||||
|         public string UserId { get; set; } |  | ||||||
|         public string ProjectId { get; set; } |  | ||||||
|         public bool Validate() |  | ||||||
|         { |  | ||||||
|             return true; |  | ||||||
|         } |  | ||||||
|     } |  | ||||||
| } |  | ||||||
| @@ -1,6 +0,0 @@ | |||||||
| @Core.Cerberos.Service.API_HostAddress = http://localhost:5145 |  | ||||||
|  |  | ||||||
| GET {{Core.Cerberos.Service.API_HostAddress}}/weatherforecast/ |  | ||||||
| Accept: application/json |  | ||||||
|  |  | ||||||
| ### |  | ||||||
| @@ -1,99 +0,0 @@ | |||||||
| using Asp.Versioning.ApiExplorer; |  | ||||||
| using Microsoft.Extensions.Options; |  | ||||||
| using Microsoft.OpenApi.Models; |  | ||||||
| using Swashbuckle.AspNetCore.SwaggerGen; |  | ||||||
| using Swashbuckle.AspNetCore.SwaggerUI; |  | ||||||
|  |  | ||||||
| namespace Core.Cerberos.Service.API.Extensions |  | ||||||
| { |  | ||||||
|     public static class SwaggerExtensions |  | ||||||
|     { |  | ||||||
|         public static void AddSwagger(this IServiceCollection services, IConfiguration configuration) |  | ||||||
|         { |  | ||||||
|             services.AddEndpointsApiExplorer(); |  | ||||||
|             AddSwaggerGen(services, configuration); |  | ||||||
|             services.AddTransient<IConfigureOptions<SwaggerGenOptions>, ConfigureSwaggerOptions>(); |  | ||||||
|         } |  | ||||||
|  |  | ||||||
|         /// <summary> |  | ||||||
|         /// Configures Swagger generation with OAuth2 security and XML comments. |  | ||||||
|         /// </summary> |  | ||||||
|         /// <param name="services">The <see cref="IServiceCollection"/> to add the services to.</param> |  | ||||||
|         /// <param name="configuration">The <see cref="IConfiguration"/> containing Swagger and OAuth2 configuration settings.</param> |  | ||||||
|         public static void AddSwaggerGen(this IServiceCollection services, IConfiguration configuration) |  | ||||||
|         { |  | ||||||
|             services.AddSwaggerGen(c => |  | ||||||
|             { |  | ||||||
|                 c.AddSecurityDefinition("Bearer", new OpenApiSecurityScheme |  | ||||||
|                 { |  | ||||||
|                     Description = "JWT Authorization header using the Bearer scheme", |  | ||||||
|                     Name = "Authorization", |  | ||||||
|                     In = ParameterLocation.Header, |  | ||||||
|                     Type = SecuritySchemeType.Http, |  | ||||||
|                     Scheme = "bearer", |  | ||||||
|                     BearerFormat = "JWT" |  | ||||||
|                 }); |  | ||||||
|  |  | ||||||
|                 c.AddSecurityRequirement(new OpenApiSecurityRequirement |  | ||||||
|                 { |  | ||||||
|                     { |  | ||||||
|                         new OpenApiSecurityScheme |  | ||||||
|                         { |  | ||||||
|                             Reference = new OpenApiReference |  | ||||||
|                             { |  | ||||||
|                                 Type = ReferenceType.SecurityScheme, |  | ||||||
|                                 Id = "Bearer" |  | ||||||
|                             } |  | ||||||
|                         }, |  | ||||||
|                         Array.Empty<string>() |  | ||||||
|                     } |  | ||||||
|                 }); |  | ||||||
|             }); |  | ||||||
|         } |  | ||||||
|         public static void ConfigureSwagger(this WebApplication app) |  | ||||||
|         { |  | ||||||
|             //Swagger Stuff Goes Here |  | ||||||
|  |  | ||||||
|             app.UseSwagger(); |  | ||||||
|             app.UseSwaggerUI(options => |  | ||||||
|             { |  | ||||||
|                 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.MapGet("/", () => Results.Redirect("/swagger/index.html")).WithTags(string.Empty); |  | ||||||
|         } |  | ||||||
|         public static IServiceCollection AddVersioning(this IServiceCollection services) |  | ||||||
|         { |  | ||||||
|             services.AddApiVersioning(options => options.ReportApiVersions = true) |  | ||||||
|                    .AddApiExplorer(options => |  | ||||||
|                    { |  | ||||||
|                        options.GroupNameFormat = "'v'VVV"; |  | ||||||
|                        options.SubstituteApiVersionInUrl = true; |  | ||||||
|                    }); |  | ||||||
|  |  | ||||||
|             return services; |  | ||||||
|         } |  | ||||||
|     } |  | ||||||
|     public class ConfigureSwaggerOptions(IApiVersionDescriptionProvider provider) : IConfigureOptions<SwaggerGenOptions> |  | ||||||
|     { |  | ||||||
|         private readonly IApiVersionDescriptionProvider _provider = provider; |  | ||||||
|  |  | ||||||
|         public void Configure(SwaggerGenOptions options) |  | ||||||
|         { |  | ||||||
|             foreach (var description in _provider.ApiVersionDescriptions) |  | ||||||
|                 options.SwaggerDoc(description.GroupName, new() |  | ||||||
|                 { |  | ||||||
|                     Title = AppDomain.CurrentDomain.FriendlyName, |  | ||||||
|                     Version = description.ApiVersion.ToString() |  | ||||||
|                 }); |  | ||||||
|  |  | ||||||
|  |  | ||||||
|             options.CustomSchemaIds(type => type.ToString().Replace("+", ".")); |  | ||||||
|         } |  | ||||||
|     } |  | ||||||
| } |  | ||||||
| @@ -1,170 +0,0 @@ | |||||||
| using Core.Cerberos.Adapters.Extensions; |  | ||||||
| using Core.Cerberos.Adapters.Helpers; |  | ||||||
| using Core.Cerberos.Application.UseCases.Modules; |  | ||||||
| using Core.Cerberos.Application.UseCases.Modules.Adapter; |  | ||||||
| using Core.Cerberos.Application.UseCases.Modules.Input; |  | ||||||
| using Core.Cerberos.Application.UseCases.Modules.Ports; |  | ||||||
| using Core.Cerberos.Application.UseCases.Modules.Validator; |  | ||||||
| using Core.Cerberos.Application.UseCases.Permissions; |  | ||||||
| using Core.Cerberos.Application.UseCases.Permissions.Adapter; |  | ||||||
| using Core.Cerberos.Application.UseCases.Permissions.Input; |  | ||||||
| using Core.Cerberos.Application.UseCases.Permissions.Ports; |  | ||||||
| using Core.Cerberos.Application.UseCases.Permissions.Validator; |  | ||||||
| using Core.Cerberos.Application.UseCases.Role; |  | ||||||
| using Core.Cerberos.Application.UseCases.Roles.Adapter; |  | ||||||
| using Core.Cerberos.Application.UseCases.Roles.Input; |  | ||||||
| using Core.Cerberos.Application.UseCases.Roles.Ports; |  | ||||||
| using Core.Cerberos.Application.UseCases.Roles.Validator; |  | ||||||
| using Core.Cerberos.Application.UseCases.Users; |  | ||||||
| using Core.Cerberos.Application.UseCases.Users.Adapter; |  | ||||||
| using Core.Cerberos.Application.UseCases.Users.Input; |  | ||||||
| using Core.Cerberos.Application.UseCases.Users.Ports; |  | ||||||
| using Core.Cerberos.Application.UseCases.Users.Validator; |  | ||||||
| using Core.Cerberos.External.ClientConfiguration; |  | ||||||
| using Core.Cerberos.Service.API.Extensions; |  | ||||||
| using FluentValidation; |  | ||||||
| using Lib.Architecture.BuildingBlocks; |  | ||||||
| using Microsoft.AspNetCore.ResponseCompression; |  | ||||||
| using System.IO.Compression; |  | ||||||
|  |  | ||||||
| var builder = WebApplication.CreateBuilder(args); |  | ||||||
|  |  | ||||||
| var authSettings = AuthHelper.GetAuthSettings(builder, "cerberos_service"); |  | ||||||
|  |  | ||||||
| builder.Services.ConfigureAuthentication(builder.Configuration, authSettings); |  | ||||||
|  |  | ||||||
| builder.Host.ConfigureServices((context, services) => |  | ||||||
| { |  | ||||||
|     services.AddCors(options => |  | ||||||
|     { |  | ||||||
|         options.AddPolicy("AllowAll", policyBuilder => |  | ||||||
|             policyBuilder.AllowAnyOrigin().AllowAnyHeader().AllowAnyMethod()); |  | ||||||
|     }); |  | ||||||
|     services.AddMvc().AddJsonOptions(options => |  | ||||||
|     { |  | ||||||
|         options.JsonSerializerOptions.WriteIndented = true; |  | ||||||
|         options.JsonSerializerOptions.MaxDepth = 20; |  | ||||||
|         options.JsonSerializerOptions.NumberHandling = System.Text.Json.Serialization.JsonNumberHandling.AllowNamedFloatingPointLiterals; |  | ||||||
|     }); |  | ||||||
|     services.Configure<BrotliCompressionProviderOptions>(options => |  | ||||||
|     { |  | ||||||
|         options.Level = CompressionLevel.SmallestSize; |  | ||||||
|     }); |  | ||||||
|     services.Configure<GzipCompressionProviderOptions>(options => |  | ||||||
|     { |  | ||||||
|         options.Level = CompressionLevel.SmallestSize; |  | ||||||
|     }); |  | ||||||
|     services.AddResponseCompression(options => |  | ||||||
|     { |  | ||||||
|         options.EnableForHttps = true; |  | ||||||
|         options.Providers.Add<BrotliCompressionProvider>(); |  | ||||||
|         options.Providers.Add<GzipCompressionProvider>(); |  | ||||||
|     }); |  | ||||||
|  |  | ||||||
|     services.AddResponseCaching(); |  | ||||||
|     services.AddControllers(); |  | ||||||
|     services.AddEndpointsApiExplorer(); |  | ||||||
|     builder.Services.AddSwagger(builder.Configuration, "Core.Cerberos.Service.API.xml", authSettings); |  | ||||||
|     builder.Services.AddVersioning(builder.Configuration); |  | ||||||
|     services.AddLogging(); |  | ||||||
|     services.AddProblemDetails(); |  | ||||||
|  |  | ||||||
|     //Register Stuff |  | ||||||
|     services.RegisterExternalLayer(builder.Configuration); |  | ||||||
|  |  | ||||||
|     services.AddScoped<IUserPort, UserPort>(); |  | ||||||
|     services.AddScoped<IComponentHandler<GetAllUsersRequest>, UserHandler>(); |  | ||||||
|     services.AddScoped<IComponentHandler<GetUserRequest>, UserHandler>(); |  | ||||||
|     services.AddScoped<IComponentHandler<LoginUserRequest>, UserHandler>(); |  | ||||||
|     services.AddScoped<IComponentHandler<LogoutUserRequest>, UserHandler>(); |  | ||||||
|     services.AddScoped<IComponentHandler<GetUserByEmailRequest>, UserHandler>(); |  | ||||||
|     services.AddScoped<IComponentHandler<AddCompanyToUserRequest>, UserHandler>(); |  | ||||||
|     services.AddScoped<IComponentHandler<RemoveCompanyFromUserRequest>, UserHandler>(); |  | ||||||
|     services.AddScoped<IComponentHandler<AddProjectToUserRequest>, UserHandler>(); |  | ||||||
|     services.AddScoped<IComponentHandler<RemoveProjectFromUserRequest>, UserHandler>(); |  | ||||||
|     services.AddScoped<IComponentHandler<ValidateUserExistenceRequest>, UserHandler>(); |  | ||||||
|     services.AddScoped<IComponentHandler<GetTokenAdapterRequest>, UserHandler>(); |  | ||||||
|     services.AddScoped<IComponentHandler<GetConsentFormPDFRequest>, UserHandler>(); |  | ||||||
|     services.AddScoped<IComponentHandler<AcceptUserConsentFormRequest>, UserHandler>(); |  | ||||||
|  |  | ||||||
|  |  | ||||||
|     services.AddValidatorsFromAssemblyContaining<CreateUserValidator>(); |  | ||||||
|     services.AddScoped<IValidator<CreateUserRequest>, CreateUserValidator>(); |  | ||||||
|     services.AddScoped<IComponentHandler<CreateUserRequest>, UserHandler>(); |  | ||||||
|  |  | ||||||
|     services.AddValidatorsFromAssemblyContaining<UpdateUserValidator>(); |  | ||||||
|     services.AddScoped<IValidator<UpdateUserRequest>, UpdateUserValidator>(); |  | ||||||
|     services.AddScoped<IComponentHandler<UpdateUserRequest>, UserHandler>(); |  | ||||||
|  |  | ||||||
|     services.AddValidatorsFromAssemblyContaining<ChangeUserStatusValidator>(); |  | ||||||
|     services.AddScoped<IValidator<ChangeUserStatusRequest>, ChangeUserStatusValidator>(); |  | ||||||
|     services.AddScoped<IComponentHandler<ChangeUserStatusRequest>, UserHandler>(); |  | ||||||
|  |  | ||||||
|     services.AddScoped<IRolePort, RolePort>(); |  | ||||||
|     services.AddScoped<IComponentHandler<GetAllRolesRequest>, RoleHandler>(); |  | ||||||
|     services.AddScoped<IComponentHandler<GetRoleRequest>, RoleHandler>(); |  | ||||||
|     services.AddScoped<IComponentHandler<AddApplicationToRoleRequest>, RoleHandler>(); |  | ||||||
|     services.AddScoped<IComponentHandler<RemoveApplicationFromRoleRequest>, RoleHandler>(); |  | ||||||
|  |  | ||||||
|     services.AddValidatorsFromAssemblyContaining<CreateRoleValidator>(); |  | ||||||
|     services.AddScoped<IValidator<CreateRoleRequest>, CreateRoleValidator>(); |  | ||||||
|     services.AddScoped<IComponentHandler<CreateRoleRequest>, RoleHandler>(); |  | ||||||
|  |  | ||||||
|     services.AddValidatorsFromAssemblyContaining<UpdateRoleValidator>(); |  | ||||||
|     services.AddScoped<IValidator<UpdateRoleRequest>, UpdateRoleValidator>(); |  | ||||||
|     services.AddScoped<IComponentHandler<UpdateRoleRequest>, RoleHandler>(); |  | ||||||
|  |  | ||||||
|     services.AddValidatorsFromAssemblyContaining<ChangeRoleStatusValidator>(); |  | ||||||
|     services.AddScoped<IValidator<ChangeRoleStatusRequest>, ChangeRoleStatusValidator>(); |  | ||||||
|     services.AddScoped<IComponentHandler<ChangeRoleStatusRequest>, RoleHandler>(); |  | ||||||
|  |  | ||||||
|     services.AddScoped<IPermissionPort, PermissionPort>(); |  | ||||||
|     services.AddScoped<IComponentHandler<GetAllPermissionsRequest>, PermissionHandler>(); |  | ||||||
|     services.AddScoped<IComponentHandler<GetPermissionRequest>, PermissionHandler>(); |  | ||||||
|     services.AddScoped<IComponentHandler<GetAllPermissionsByListRequest>, PermissionHandler>(); |  | ||||||
|  |  | ||||||
|     services.AddValidatorsFromAssemblyContaining<CreatePermissionValidator>(); |  | ||||||
|     services.AddScoped<IValidator<CreatePermissionRequest>, CreatePermissionValidator>(); |  | ||||||
|     services.AddScoped<IComponentHandler<CreatePermissionRequest>, PermissionHandler>(); |  | ||||||
|  |  | ||||||
|     services.AddValidatorsFromAssemblyContaining<UpdatePermissionValidator>(); |  | ||||||
|     services.AddScoped<IValidator<UpdatePermissionRequest>, UpdatePermissionValidator>(); |  | ||||||
|     services.AddScoped<IComponentHandler<UpdatePermissionRequest>, PermissionHandler>(); |  | ||||||
|  |  | ||||||
|     services.AddValidatorsFromAssemblyContaining<ChangePermissionStatusValidator>(); |  | ||||||
|     services.AddScoped<IValidator<ChangePermissionStatusRequest>, ChangePermissionStatusValidator>(); |  | ||||||
|     services.AddScoped<IComponentHandler<ChangePermissionStatusRequest>, PermissionHandler>(); |  | ||||||
|  |  | ||||||
|     services.AddScoped<IModulePort, ModulePort>(); |  | ||||||
|     services.AddScoped<IComponentHandler<GetAllModulesRequest>, ModuleHandler>(); |  | ||||||
|     services.AddScoped<IComponentHandler<GetModuleRequest>, ModuleHandler>(); |  | ||||||
|  |  | ||||||
|     services.AddValidatorsFromAssemblyContaining<GetAllModulesByListValidator>(); |  | ||||||
|     services.AddScoped<IValidator<GetAllModulesByListRequest>, GetAllModulesByListValidator>(); |  | ||||||
|     services.AddScoped<IComponentHandler<GetAllModulesByListRequest>, ModuleHandler>(); |  | ||||||
|  |  | ||||||
|     services.AddValidatorsFromAssemblyContaining<CreateModuleValidator>(); |  | ||||||
|     services.AddScoped<IValidator<CreateModuleRequest>, CreateModuleValidator>(); |  | ||||||
|     services.AddScoped<IComponentHandler<CreateModuleRequest>, ModuleHandler>(); |  | ||||||
|  |  | ||||||
|     services.AddValidatorsFromAssemblyContaining<UpdateModuleValidator>(); |  | ||||||
|     services.AddScoped<IValidator<UpdateModuleRequest>, UpdateModuleValidator>(); |  | ||||||
|     services.AddScoped<IComponentHandler<UpdateModuleRequest>, ModuleHandler>(); |  | ||||||
|  |  | ||||||
|     services.AddValidatorsFromAssemblyContaining<ChangeModuleStatusValidator>(); |  | ||||||
|     services.AddScoped<IValidator<ChangeModuleStatusRequest>, ChangeModuleStatusValidator>(); |  | ||||||
|     services.AddScoped<IComponentHandler<ChangeModuleStatusRequest>, ModuleHandler>(); |  | ||||||
| }); |  | ||||||
|  |  | ||||||
| var app = builder.Build(); |  | ||||||
| app.UseSwaggerUI(builder.Configuration, authSettings); |  | ||||||
| app.ConfigureSwagger(builder.Configuration); |  | ||||||
| app.UseResponseCompression(); |  | ||||||
| app.UseResponseCaching(); |  | ||||||
| app.UseHttpsRedirection(); |  | ||||||
| app.UseCors("AllowAll"); |  | ||||||
| app.UseAuthorization(); |  | ||||||
| app.MapControllers(); |  | ||||||
|  |  | ||||||
| app.Run(); |  | ||||||
|  |  | ||||||
| @@ -1,12 +0,0 @@ | |||||||
| { |  | ||||||
|   "Logging": { |  | ||||||
|     "LogLevel": { |  | ||||||
|       "Default": "Information", |  | ||||||
|       "Microsoft.AspNetCore": "Warning" |  | ||||||
|     } |  | ||||||
|   }, |  | ||||||
|   "AllowedHosts": "*", |  | ||||||
|   "Endpoints": { |  | ||||||
|     "AppConfigurationURI": "https://sandbox-hci-usc-appcg.azconfig.io" |  | ||||||
|   } |  | ||||||
| } |  | ||||||
							
								
								
									
										21
									
								
								Core.Thalos.Application/Core.Thalos.Application.csproj
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								Core.Thalos.Application/Core.Thalos.Application.csproj
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,21 @@ | |||||||
|  | <Project Sdk="Microsoft.NET.Sdk"> | ||||||
|  |  | ||||||
|  |   <PropertyGroup> | ||||||
|  |     <TargetFramework>net8.0</TargetFramework> | ||||||
|  |     <ImplicitUsings>enable</ImplicitUsings> | ||||||
|  |     <Nullable>enable</Nullable> | ||||||
|  |   </PropertyGroup> | ||||||
|  |  | ||||||
|  |   <ItemGroup> | ||||||
|  |     <PackageReference Include="MongoDB.Driver" Version="3.1.0" /> | ||||||
|  |   </ItemGroup> | ||||||
|  |  | ||||||
|  |   <ItemGroup> | ||||||
|  |     <ProjectReference Include="..\Core.Thalos.External\Core.Thalos.External.csproj" /> | ||||||
|  |   </ItemGroup> | ||||||
|  |  | ||||||
|  |   <ItemGroup> | ||||||
|  |     <Folder Include="UseCases\Users\Ports\" /> | ||||||
|  |   </ItemGroup> | ||||||
|  |  | ||||||
|  | </Project> | ||||||
| @@ -1,9 +1,9 @@ | |||||||
| using Core.Cerberos.Adapters; | using Core.Thalos.Application.UseCases.Modules.Ports; | ||||||
| using Core.Cerberos.Application.UseCases.Modules.Ports; | using Core.Thalos.BuildingBlocks; | ||||||
| using Lib.Architecture.BuildingBlocks; | using Lib.Architecture.BuildingBlocks; | ||||||
| using Microsoft.AspNetCore.Mvc; | using Microsoft.AspNetCore.Mvc; | ||||||
| 
 | 
 | ||||||
| namespace Core.Cerberos.Application.UseCases.Modules.Adapter | namespace Core.Thalos.Application.UseCases.Modules.Adapter | ||||||
| { | { | ||||||
|     public class ModulePort : BasePresenter, IModulePort |     public class ModulePort : BasePresenter, IModulePort | ||||||
|     { |     { | ||||||
| @@ -1,7 +1,7 @@ | |||||||
| using Core.Cerberos.Adapters.Common.Enums; | using Core.Blueprint.Mongo; | ||||||
| using Lib.Architecture.BuildingBlocks; | using Lib.Architecture.BuildingBlocks; | ||||||
| 
 | 
 | ||||||
| namespace Core.Cerberos.Application.UseCases.Modules.Input | namespace Core.Thalos.Application.UseCases.Modules.Input | ||||||
| { | { | ||||||
|     public class ChangeModuleStatusRequest : Notificator, ICommand |     public class ChangeModuleStatusRequest : Notificator, ICommand | ||||||
|     { |     { | ||||||
| @@ -1,7 +1,7 @@ | |||||||
| using Core.Cerberos.Adapters.Common.Enums; | using Core.Thalos.BuildingBlocks; | ||||||
| using Lib.Architecture.BuildingBlocks; | using Lib.Architecture.BuildingBlocks; | ||||||
| 
 | 
 | ||||||
| namespace Core.Cerberos.Application.UseCases.Modules.Input | namespace Core.Thalos.Application.UseCases.Modules.Input | ||||||
| { | { | ||||||
|     public class CreateModuleRequest : Notificator, ICommand |     public class CreateModuleRequest : Notificator, ICommand | ||||||
|     { |     { | ||||||
| @@ -1,6 +1,6 @@ | |||||||
| using Lib.Architecture.BuildingBlocks; | using Lib.Architecture.BuildingBlocks; | ||||||
| 
 | 
 | ||||||
| namespace Core.Cerberos.Application.UseCases.Modules.Input | namespace Core.Thalos.Application.UseCases.Modules.Input | ||||||
| { | { | ||||||
|     public class GetAllModulesByListRequest : Notificator, ICommand |     public class GetAllModulesByListRequest : Notificator, ICommand | ||||||
|     { |     { | ||||||
| @@ -1,6 +1,6 @@ | |||||||
| using Lib.Architecture.BuildingBlocks; | using Lib.Architecture.BuildingBlocks; | ||||||
| 
 | 
 | ||||||
| namespace Core.Cerberos.Application.UseCases.Modules.Input | namespace Core.Thalos.Application.UseCases.Modules.Input | ||||||
| { | { | ||||||
|     public class GetAllModulesRequest : ICommand |     public class GetAllModulesRequest : ICommand | ||||||
|     { |     { | ||||||
| @@ -1,6 +1,6 @@ | |||||||
| using Lib.Architecture.BuildingBlocks; | using Lib.Architecture.BuildingBlocks; | ||||||
| 
 | 
 | ||||||
| namespace Core.Cerberos.Application.UseCases.Modules.Input | namespace Core.Thalos.Application.UseCases.Modules.Input | ||||||
| { | { | ||||||
|     public class GetModuleRequest : Notificator, ICommand |     public class GetModuleRequest : Notificator, ICommand | ||||||
|     { |     { | ||||||
| @@ -1,7 +1,7 @@ | |||||||
| using Core.Cerberos.Adapters.Common.Enums; | using Core.Thalos.BuildingBlocks; | ||||||
| using Lib.Architecture.BuildingBlocks; | using Lib.Architecture.BuildingBlocks; | ||||||
| 
 | 
 | ||||||
| namespace Core.Cerberos.Application.UseCases.Modules.Input | namespace Core.Thalos.Application.UseCases.Modules.Input | ||||||
| { | { | ||||||
|     public class UpdateModuleRequest : Notificator, ICommand |     public class UpdateModuleRequest : Notificator, ICommand | ||||||
|     { |     { | ||||||
| @@ -12,7 +12,6 @@ namespace Core.Cerberos.Application.UseCases.Modules.Input | |||||||
|         public string Route { get; set; } = null!; |         public string Route { get; set; } = null!; | ||||||
|         public int? Order { get; set; } |         public int? Order { get; set; } | ||||||
|         public ApplicationsEnum? Application { get; set; } = null!; |         public ApplicationsEnum? Application { get; set; } = null!; | ||||||
|         public StatusEnum Status { get; set; } |  | ||||||
|         public bool Validate() |         public bool Validate() | ||||||
|         { |         { | ||||||
|             return Id != null; |             return Id != null; | ||||||
| @@ -1,13 +1,13 @@ | |||||||
| using Core.Cerberos.Adapters; | using Core.Thalos.Application.UseCases.Modules.Input; | ||||||
| using Core.Cerberos.Application.UseCases.Modules.Input; | using Core.Thalos.Application.UseCases.Modules.Ports; | ||||||
| using Core.Cerberos.Application.UseCases.Modules.Ports; | using Core.Thalos.BuildingBlocks; | ||||||
| using Core.Cerberos.External.Clients; | using Core.Thalos.External.Clients; | ||||||
| using Core.Cerberos.External.Clients.Requests; | using Core.Thalos.External.Clients.Requests; | ||||||
| using FluentValidation; | using FluentValidation; | ||||||
| using Lib.Architecture.BuildingBlocks; | using Lib.Architecture.BuildingBlocks; | ||||||
| using Lib.Architecture.BuildingBlocks.Helpers; | using Lib.Architecture.BuildingBlocks.Helpers; | ||||||
| 
 | 
 | ||||||
| namespace Core.Cerberos.Application.UseCases.Modules | namespace Core.Thalos.Application.UseCases.Modules | ||||||
| { | { | ||||||
|     public class ModuleHandler : |     public class ModuleHandler : | ||||||
|         IComponentHandler<ChangeModuleStatusRequest>, |         IComponentHandler<ChangeModuleStatusRequest>, | ||||||
| @@ -22,7 +22,7 @@ namespace Core.Cerberos.Application.UseCases.Modules | |||||||
|         private readonly IValidator<CreateModuleRequest> _registerModuleValidator; |         private readonly IValidator<CreateModuleRequest> _registerModuleValidator; | ||||||
|         private readonly IValidator<UpdateModuleRequest> _updateModuleValidator; |         private readonly IValidator<UpdateModuleRequest> _updateModuleValidator; | ||||||
|         private readonly IValidator<GetAllModulesByListRequest> _modulesByListValidator; |         private readonly IValidator<GetAllModulesByListRequest> _modulesByListValidator; | ||||||
|         private readonly ICerberosServiceClient _cerberosDALService; |         private readonly IThalosServiceClient _thalosDALService; | ||||||
| 
 | 
 | ||||||
|         public ModuleHandler( |         public ModuleHandler( | ||||||
|             IModulePort port, |             IModulePort port, | ||||||
| @@ -30,13 +30,13 @@ namespace Core.Cerberos.Application.UseCases.Modules | |||||||
|             IValidator<CreateModuleRequest> registerModuleValidator, |             IValidator<CreateModuleRequest> registerModuleValidator, | ||||||
|             IValidator<UpdateModuleRequest> updateModuleValidator, |             IValidator<UpdateModuleRequest> updateModuleValidator, | ||||||
|             IValidator<GetAllModulesByListRequest> modulesByListValidator, |             IValidator<GetAllModulesByListRequest> modulesByListValidator, | ||||||
|             ICerberosServiceClient cerberosDALService) |             IThalosServiceClient thalosDALService) | ||||||
|         { |         { | ||||||
|             _port = port ?? throw new ArgumentNullException(nameof(port)); |             _port = port ?? throw new ArgumentNullException(nameof(port)); | ||||||
|             _changeModuleStatusValidator = changeModuleStatusValidator ?? throw new ArgumentNullException(nameof(changeModuleStatusValidator)); |             _changeModuleStatusValidator = changeModuleStatusValidator ?? throw new ArgumentNullException(nameof(changeModuleStatusValidator)); | ||||||
|             _registerModuleValidator = registerModuleValidator ?? throw new ArgumentNullException(nameof(registerModuleValidator)); |             _registerModuleValidator = registerModuleValidator ?? throw new ArgumentNullException(nameof(registerModuleValidator)); | ||||||
|             _updateModuleValidator = updateModuleValidator ?? throw new ArgumentNullException(nameof(updateModuleValidator)); |             _updateModuleValidator = updateModuleValidator ?? throw new ArgumentNullException(nameof(updateModuleValidator)); | ||||||
|             _cerberosDALService = cerberosDALService ?? throw new ArgumentNullException(nameof(cerberosDALService)); |             _thalosDALService = thalosDALService ?? throw new ArgumentNullException(nameof(thalosDALService)); | ||||||
|             _modulesByListValidator = modulesByListValidator ?? throw new ArgumentNullException(nameof(modulesByListValidator)); |             _modulesByListValidator = modulesByListValidator ?? throw new ArgumentNullException(nameof(modulesByListValidator)); | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
| @@ -46,7 +46,7 @@ namespace Core.Cerberos.Application.UseCases.Modules | |||||||
|             { |             { | ||||||
|                 ArgumentNullException.ThrowIfNull(command); |                 ArgumentNullException.ThrowIfNull(command); | ||||||
| 
 | 
 | ||||||
|                 var result = await _cerberosDALService.GetModuleByIdAsync(command.Id, cancellationToken).ConfigureAwait(false); |                 var result = await _thalosDALService.GetModuleByIdAsync(command.Id, cancellationToken).ConfigureAwait(false); | ||||||
| 
 | 
 | ||||||
|                 if (result == null) |                 if (result == null) | ||||||
|                 { |                 { | ||||||
| @@ -68,7 +68,7 @@ namespace Core.Cerberos.Application.UseCases.Modules | |||||||
|             { |             { | ||||||
|                 ArgumentNullException.ThrowIfNull(command); |                 ArgumentNullException.ThrowIfNull(command); | ||||||
| 
 | 
 | ||||||
|                 var _result = await _cerberosDALService.GetAllModulesAsync().ConfigureAwait(false); |                 var _result = await _thalosDALService.GetAllModulesAsync().ConfigureAwait(false); | ||||||
|                 if (!_result.Any()) |                 if (!_result.Any()) | ||||||
|                 { |                 { | ||||||
|                     _port.NoContentSuccess(); |                     _port.NoContentSuccess(); | ||||||
| @@ -94,7 +94,7 @@ namespace Core.Cerberos.Application.UseCases.Modules | |||||||
|                     return; |                     return; | ||||||
|                 } |                 } | ||||||
| 
 | 
 | ||||||
|                 var _result = await _cerberosDALService.GetAllModulesByListAsync(command.Modules, cancellationToken).ConfigureAwait(false); |                 var _result = await _thalosDALService.GetAllModulesByListAsync(command.Modules, cancellationToken).ConfigureAwait(false); | ||||||
|                 if (!_result.Any()) |                 if (!_result.Any()) | ||||||
|                 { |                 { | ||||||
|                     _port.NoContentSuccess(); |                     _port.NoContentSuccess(); | ||||||
| @@ -120,7 +120,7 @@ namespace Core.Cerberos.Application.UseCases.Modules | |||||||
|                     return; |                     return; | ||||||
|                 } |                 } | ||||||
| 
 | 
 | ||||||
|                 var result = await _cerberosDALService.ChangeStatusModuleAsync(command.Id, command.Status, cancellationToken).ConfigureAwait(false); |                 var result = await _thalosDALService.ChangeStatusModuleAsync(command.Id, command.Status, cancellationToken).ConfigureAwait(false); | ||||||
| 
 | 
 | ||||||
|                 if (result == null) |                 if (result == null) | ||||||
|                 { |                 { | ||||||
| @@ -158,7 +158,7 @@ namespace Core.Cerberos.Application.UseCases.Modules | |||||||
|                     Application = command.Application, |                     Application = command.Application, | ||||||
|                 }; |                 }; | ||||||
| 
 | 
 | ||||||
|                 var result = await _cerberosDALService.CreateModuleAsync(request, cancellationToken).ConfigureAwait(false); |                 var result = await _thalosDALService.CreateModuleAsync(request, cancellationToken).ConfigureAwait(false); | ||||||
| 
 | 
 | ||||||
|                 if (result == null) |                 if (result == null) | ||||||
|                 { |                 { | ||||||
| @@ -194,13 +194,12 @@ namespace Core.Cerberos.Application.UseCases.Modules | |||||||
|                     Application = command.Application, |                     Application = command.Application, | ||||||
|                     Route = command.Route, |                     Route = command.Route, | ||||||
|                     Order = command.Order, |                     Order = command.Order, | ||||||
|                     Icon = command.Icon, |                     Icon = command.Icon | ||||||
|                     Status = command.Status |  | ||||||
|                 }; |                 }; | ||||||
| 
 | 
 | ||||||
|                 string id = command.Id; |                 string id = command.Id; | ||||||
| 
 | 
 | ||||||
|                 var result = await _cerberosDALService.UpdateModuleAsync(request, id, cancellationToken).ConfigureAwait(false); |                 var result = await _thalosDALService.UpdateModuleAsync(request, id, cancellationToken).ConfigureAwait(false); | ||||||
| 
 | 
 | ||||||
|                 if (result == null) |                 if (result == null) | ||||||
|                 { |                 { | ||||||
| @@ -1,13 +1,14 @@ | |||||||
| using Core.Cerberos.Adapters; | using Core.Thalos.BuildingBlocks; | ||||||
| using Lib.Architecture.BuildingBlocks; | using Lib.Architecture.BuildingBlocks; | ||||||
| 
 | 
 | ||||||
| namespace Core.Cerberos.Application.UseCases.Modules.Ports | namespace Core.Thalos.Application.UseCases.Modules.Ports | ||||||
| { | { | ||||||
|     public interface IModulePort : IBasePort, |     public interface IModulePort : IBasePort, | ||||||
|         ICommandSuccessPort<ModuleAdapter>, |         ICommandSuccessPort<ModuleAdapter>, | ||||||
|         ICommandSuccessPort<List<ModuleAdapter>>, |         ICommandSuccessPort<List<ModuleAdapter>>, | ||||||
|         INoContentPort, IBusinessErrorPort, ITimeoutPort, IValidationErrorPort, |         INoContentPort, IBusinessErrorPort, ITimeoutPort, IValidationErrorPort, | ||||||
|         INotFoundPort, IForbiddenPort, IUnauthorizedPort, IInternalServerErrorPort |         INotFoundPort, IForbiddenPort, IUnauthorizedPort, IInternalServerErrorPort, | ||||||
|  |         IBadRequestPort | ||||||
|     { |     { | ||||||
|     } |     } | ||||||
| } | } | ||||||
| @@ -1,7 +1,7 @@ | |||||||
| using Core.Cerberos.Application.UseCases.Modules.Input; | using Core.Thalos.Application.UseCases.Modules.Input; | ||||||
| using FluentValidation; | using FluentValidation; | ||||||
| 
 | 
 | ||||||
| namespace Core.Cerberos.Application.UseCases.Modules.Validator | namespace Core.Thalos.Application.UseCases.Modules.Validator | ||||||
| { | { | ||||||
|     public class ChangeModuleStatusValidator : AbstractValidator<ChangeModuleStatusRequest> |     public class ChangeModuleStatusValidator : AbstractValidator<ChangeModuleStatusRequest> | ||||||
|     { |     { | ||||||
| @@ -1,7 +1,7 @@ | |||||||
| using Core.Cerberos.Application.UseCases.Modules.Input; | using Core.Thalos.Application.UseCases.Modules.Input; | ||||||
| using FluentValidation; | using FluentValidation; | ||||||
| 
 | 
 | ||||||
| namespace Core.Cerberos.Application.UseCases.Modules.Validator | namespace Core.Thalos.Application.UseCases.Modules.Validator | ||||||
| { | { | ||||||
|     public class CreateModuleValidator : AbstractValidator<CreateModuleRequest> |     public class CreateModuleValidator : AbstractValidator<CreateModuleRequest> | ||||||
|     { |     { | ||||||
| @@ -1,7 +1,7 @@ | |||||||
| using Core.Cerberos.Application.UseCases.Modules.Input; | using Core.Thalos.Application.UseCases.Modules.Input; | ||||||
| using FluentValidation; | using FluentValidation; | ||||||
| 
 | 
 | ||||||
| namespace Core.Cerberos.Application.UseCases.Modules.Validator | namespace Core.Thalos.Application.UseCases.Modules.Validator | ||||||
| { | { | ||||||
|     public class GetAllModulesByListValidator : AbstractValidator<GetAllModulesByListRequest> |     public class GetAllModulesByListValidator : AbstractValidator<GetAllModulesByListRequest> | ||||||
|     { |     { | ||||||
| @@ -1,7 +1,7 @@ | |||||||
| using Core.Cerberos.Application.UseCases.Modules.Input; | using Core.Thalos.Application.UseCases.Modules.Input; | ||||||
| using FluentValidation; | using FluentValidation; | ||||||
| 
 | 
 | ||||||
| namespace Core.Cerberos.Application.UseCases.Modules.Validator | namespace Core.Thalos.Application.UseCases.Modules.Validator | ||||||
| { | { | ||||||
|     public class UpdateModuleValidator : AbstractValidator<UpdateModuleRequest> |     public class UpdateModuleValidator : AbstractValidator<UpdateModuleRequest> | ||||||
|     { |     { | ||||||
| @@ -1,9 +1,9 @@ | |||||||
| using Core.Cerberos.Adapters; | using Core.Thalos.Application.UseCases.Permissions.Ports; | ||||||
| using Core.Cerberos.Application.UseCases.Permissions.Ports; | using Core.Thalos.BuildingBlocks; | ||||||
| using Lib.Architecture.BuildingBlocks; | using Lib.Architecture.BuildingBlocks; | ||||||
| using Microsoft.AspNetCore.Mvc; | using Microsoft.AspNetCore.Mvc; | ||||||
| 
 | 
 | ||||||
| namespace Core.Cerberos.Application.UseCases.Permissions.Adapter | namespace Core.Thalos.Application.UseCases.Permissions.Adapter | ||||||
| { | { | ||||||
|     public class PermissionPort : BasePresenter, IPermissionPort |     public class PermissionPort : BasePresenter, IPermissionPort | ||||||
|     { |     { | ||||||
| @@ -1,7 +1,7 @@ | |||||||
| using Core.Cerberos.Adapters.Common.Enums; | using Core.Blueprint.Mongo; | ||||||
| using Lib.Architecture.BuildingBlocks; | using Lib.Architecture.BuildingBlocks; | ||||||
| 
 | 
 | ||||||
| namespace Core.Cerberos.Application.UseCases.Permissions.Input | namespace Core.Thalos.Application.UseCases.Permissions.Input | ||||||
| { | { | ||||||
|     public class ChangePermissionStatusRequest : Notificator, ICommand |     public class ChangePermissionStatusRequest : Notificator, ICommand | ||||||
|     { |     { | ||||||
| @@ -1,7 +1,7 @@ | |||||||
| using Core.Cerberos.Adapters.Common.Constants; | using Core.Thalos.BuildingBlocks; | ||||||
| using Lib.Architecture.BuildingBlocks; | using Lib.Architecture.BuildingBlocks; | ||||||
| 
 | 
 | ||||||
| namespace Core.Cerberos.Application.UseCases.Permissions.Input | namespace Core.Thalos.Application.UseCases.Permissions.Input | ||||||
| { | { | ||||||
|     public class CreatePermissionRequest : Notificator, ICommand |     public class CreatePermissionRequest : Notificator, ICommand | ||||||
|     { |     { | ||||||
| @@ -1,6 +1,6 @@ | |||||||
| using Lib.Architecture.BuildingBlocks; | using Lib.Architecture.BuildingBlocks; | ||||||
| 
 | 
 | ||||||
| namespace Core.Cerberos.Application.UseCases.Permissions.Input | namespace Core.Thalos.Application.UseCases.Permissions.Input | ||||||
| { | { | ||||||
|     public class GetAllPermissionsByListRequest : ICommand |     public class GetAllPermissionsByListRequest : ICommand | ||||||
|     { |     { | ||||||
| @@ -1,6 +1,6 @@ | |||||||
| using Lib.Architecture.BuildingBlocks; | using Lib.Architecture.BuildingBlocks; | ||||||
| 
 | 
 | ||||||
| namespace Core.Cerberos.Application.UseCases.Permissions.Input | namespace Core.Thalos.Application.UseCases.Permissions.Input | ||||||
| { | { | ||||||
|     public class GetAllPermissionsRequest : ICommand |     public class GetAllPermissionsRequest : ICommand | ||||||
|     { |     { | ||||||
| @@ -1,6 +1,6 @@ | |||||||
| using Lib.Architecture.BuildingBlocks; | using Lib.Architecture.BuildingBlocks; | ||||||
| 
 | 
 | ||||||
| namespace Core.Cerberos.Application.UseCases.Permissions.Input | namespace Core.Thalos.Application.UseCases.Permissions.Input | ||||||
| { | { | ||||||
|     public class GetPermissionRequest : Notificator, ICommand |     public class GetPermissionRequest : Notificator, ICommand | ||||||
|     { |     { | ||||||
| @@ -1,8 +1,7 @@ | |||||||
| using Core.Cerberos.Adapters.Common.Constants; | using Core.Thalos.BuildingBlocks; | ||||||
| using Core.Cerberos.Adapters.Common.Enums; |  | ||||||
| using Lib.Architecture.BuildingBlocks; | using Lib.Architecture.BuildingBlocks; | ||||||
| 
 | 
 | ||||||
| namespace Core.Cerberos.Application.UseCases.Permissions.Input | namespace Core.Thalos.Application.UseCases.Permissions.Input | ||||||
| { | { | ||||||
|     public class UpdatePermissionRequest : Notificator, ICommand |     public class UpdatePermissionRequest : Notificator, ICommand | ||||||
|     { |     { | ||||||
| @@ -10,7 +9,7 @@ namespace Core.Cerberos.Application.UseCases.Permissions.Input | |||||||
|         public string Name { get; set; } = null!; |         public string Name { get; set; } = null!; | ||||||
|         public string? Description { get; set; } |         public string? Description { get; set; } | ||||||
|         public AccessLevelEnum? AccessLevel { get; set; } = null!; |         public AccessLevelEnum? AccessLevel { get; set; } = null!; | ||||||
|         public StatusEnum Status { get; set; } |         public Blueprint.Mongo.StatusEnum Status { get; set; } | ||||||
|         public bool Validate() |         public bool Validate() | ||||||
|         { |         { | ||||||
|             return Id != null; |             return Id != null; | ||||||
| @@ -1,13 +1,13 @@ | |||||||
| using Core.Cerberos.Adapters; | using Core.Thalos.Application.UseCases.Permissions.Input; | ||||||
| using Core.Cerberos.Application.UseCases.Permissions.Input; | using Core.Thalos.Application.UseCases.Permissions.Ports; | ||||||
| using Core.Cerberos.Application.UseCases.Permissions.Ports; | using Core.Thalos.BuildingBlocks; | ||||||
| using Core.Cerberos.External.Clients; | using Core.Thalos.External.Clients; | ||||||
| using Core.Cerberos.External.Clients.Requests; | using Core.Thalos.External.Clients.Requests; | ||||||
| using FluentValidation; | using FluentValidation; | ||||||
| using Lib.Architecture.BuildingBlocks; | using Lib.Architecture.BuildingBlocks; | ||||||
| using Lib.Architecture.BuildingBlocks.Helpers; | using Lib.Architecture.BuildingBlocks.Helpers; | ||||||
| 
 | 
 | ||||||
| namespace Core.Cerberos.Application.UseCases.Permissions | namespace Core.Thalos.Application.UseCases.Permissions | ||||||
| { | { | ||||||
|     public class PermissionHandler : |     public class PermissionHandler : | ||||||
|         IComponentHandler<ChangePermissionStatusRequest>, |         IComponentHandler<ChangePermissionStatusRequest>, | ||||||
| @@ -21,20 +21,20 @@ namespace Core.Cerberos.Application.UseCases.Permissions | |||||||
|         private readonly IValidator<ChangePermissionStatusRequest> _changePermissionStatusValidator; |         private readonly IValidator<ChangePermissionStatusRequest> _changePermissionStatusValidator; | ||||||
|         private readonly IValidator<CreatePermissionRequest> _registerPermissionValidator; |         private readonly IValidator<CreatePermissionRequest> _registerPermissionValidator; | ||||||
|         private readonly IValidator<UpdatePermissionRequest> _updatePermissionValidator; |         private readonly IValidator<UpdatePermissionRequest> _updatePermissionValidator; | ||||||
|         private readonly ICerberosServiceClient _cerberosDALService; |         private readonly IThalosServiceClient _thalosDALService; | ||||||
| 
 | 
 | ||||||
|         public PermissionHandler( |         public PermissionHandler( | ||||||
|             IPermissionPort port, |             IPermissionPort port, | ||||||
|             IValidator<ChangePermissionStatusRequest> changePermissionStatusValidator, |             IValidator<ChangePermissionStatusRequest> changePermissionStatusValidator, | ||||||
|             IValidator<CreatePermissionRequest> registerPermissionValidator, |             IValidator<CreatePermissionRequest> registerPermissionValidator, | ||||||
|             IValidator<UpdatePermissionRequest> updatePermissionValidator, |             IValidator<UpdatePermissionRequest> updatePermissionValidator, | ||||||
|             ICerberosServiceClient cerberosDALService) |             IThalosServiceClient thalosDALService) | ||||||
|         { |         { | ||||||
|             _port = port ?? throw new ArgumentNullException(nameof(port)); |             _port = port ?? throw new ArgumentNullException(nameof(port)); | ||||||
|             _changePermissionStatusValidator = changePermissionStatusValidator ?? throw new ArgumentNullException(nameof(changePermissionStatusValidator)); |             _changePermissionStatusValidator = changePermissionStatusValidator ?? throw new ArgumentNullException(nameof(changePermissionStatusValidator)); | ||||||
|             _registerPermissionValidator = registerPermissionValidator ?? throw new ArgumentNullException(nameof(registerPermissionValidator)); |             _registerPermissionValidator = registerPermissionValidator ?? throw new ArgumentNullException(nameof(registerPermissionValidator)); | ||||||
|             _updatePermissionValidator = updatePermissionValidator ?? throw new ArgumentNullException(nameof(updatePermissionValidator)); |             _updatePermissionValidator = updatePermissionValidator ?? throw new ArgumentNullException(nameof(updatePermissionValidator)); | ||||||
|             _cerberosDALService = cerberosDALService ?? throw new ArgumentNullException(nameof(cerberosDALService)); |             _thalosDALService = thalosDALService ?? throw new ArgumentNullException(nameof(thalosDALService)); | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         public async ValueTask ExecuteAsync(GetPermissionRequest command, CancellationToken cancellationToken = default) |         public async ValueTask ExecuteAsync(GetPermissionRequest command, CancellationToken cancellationToken = default) | ||||||
| @@ -43,7 +43,7 @@ namespace Core.Cerberos.Application.UseCases.Permissions | |||||||
|             { |             { | ||||||
|                 ArgumentNullException.ThrowIfNull(command); |                 ArgumentNullException.ThrowIfNull(command); | ||||||
| 
 | 
 | ||||||
|                 var result = await _cerberosDALService.GetPermissionByIdAsync(command.Id, cancellationToken).ConfigureAwait(false); |                 var result = await _thalosDALService.GetPermissionByIdAsync(command.Id, cancellationToken).ConfigureAwait(false); | ||||||
| 
 | 
 | ||||||
|                 if (result == null) |                 if (result == null) | ||||||
|                 { |                 { | ||||||
| @@ -65,7 +65,7 @@ namespace Core.Cerberos.Application.UseCases.Permissions | |||||||
|             { |             { | ||||||
|                 ArgumentNullException.ThrowIfNull(command); |                 ArgumentNullException.ThrowIfNull(command); | ||||||
| 
 | 
 | ||||||
|                 var _result = await _cerberosDALService.GetAllPermissionsAsync().ConfigureAwait(false); |                 var _result = await _thalosDALService.GetAllPermissionsAsync().ConfigureAwait(false); | ||||||
|                 if (!_result.Any()) |                 if (!_result.Any()) | ||||||
|                 { |                 { | ||||||
|                     _port.NoContentSuccess(); |                     _port.NoContentSuccess(); | ||||||
| @@ -85,7 +85,7 @@ namespace Core.Cerberos.Application.UseCases.Permissions | |||||||
|             { |             { | ||||||
|                 ArgumentNullException.ThrowIfNull(command); |                 ArgumentNullException.ThrowIfNull(command); | ||||||
| 
 | 
 | ||||||
|                 var _result = await _cerberosDALService.GetAllPermissionsByListAsync(command.Permissions, cancellationToken).ConfigureAwait(false); |                 var _result = await _thalosDALService.GetAllPermissionsByListAsync(command.Permissions, cancellationToken).ConfigureAwait(false); | ||||||
|                 if (!_result.Any()) |                 if (!_result.Any()) | ||||||
|                 { |                 { | ||||||
|                     _port.NoContentSuccess(); |                     _port.NoContentSuccess(); | ||||||
| @@ -111,7 +111,7 @@ namespace Core.Cerberos.Application.UseCases.Permissions | |||||||
|                     return; |                     return; | ||||||
|                 } |                 } | ||||||
| 
 | 
 | ||||||
|                 var result = await _cerberosDALService.ChangeStatusPermissionAsync(command.Id, command.Status, cancellationToken).ConfigureAwait(false); |                 var result = await _thalosDALService.ChangeStatusPermissionAsync(command.Id, command.Status, cancellationToken).ConfigureAwait(false); | ||||||
| 
 | 
 | ||||||
|                 if (result == null) |                 if (result == null) | ||||||
|                 { |                 { | ||||||
| @@ -146,7 +146,7 @@ namespace Core.Cerberos.Application.UseCases.Permissions | |||||||
|                     AccessLevel = command.AccessLevel |                     AccessLevel = command.AccessLevel | ||||||
|                 }; |                 }; | ||||||
| 
 | 
 | ||||||
|                 var result = await _cerberosDALService.CreatePermissionAsync(request, cancellationToken).ConfigureAwait(false); |                 var result = await _thalosDALService.CreatePermissionAsync(request, cancellationToken).ConfigureAwait(false); | ||||||
| 
 | 
 | ||||||
|                 if (result == null) |                 if (result == null) | ||||||
|                 { |                 { | ||||||
| @@ -179,13 +179,12 @@ namespace Core.Cerberos.Application.UseCases.Permissions | |||||||
|                     Id = command.Id, |                     Id = command.Id, | ||||||
|                     Name = command.Name, |                     Name = command.Name, | ||||||
|                     Description = command.Description, |                     Description = command.Description, | ||||||
|                     AccessLevel = command.AccessLevel, |                     AccessLevel = command.AccessLevel | ||||||
|                     Status = command.Status |  | ||||||
|                 }; |                 }; | ||||||
| 
 | 
 | ||||||
|                 string id = command.Id; |                 string id = command.Id; | ||||||
| 
 | 
 | ||||||
|                 var result = await _cerberosDALService.UpdatePermissionAsync(request, id, cancellationToken).ConfigureAwait(false); |                 var result = await _thalosDALService.UpdatePermissionAsync(request, id, cancellationToken).ConfigureAwait(false); | ||||||
| 
 | 
 | ||||||
|                 if (result == null) |                 if (result == null) | ||||||
|                 { |                 { | ||||||
| @@ -1,13 +1,14 @@ | |||||||
| using Core.Cerberos.Adapters; | using Core.Thalos.BuildingBlocks; | ||||||
| using Lib.Architecture.BuildingBlocks; | using Lib.Architecture.BuildingBlocks; | ||||||
| 
 | 
 | ||||||
| namespace Core.Cerberos.Application.UseCases.Permissions.Ports | namespace Core.Thalos.Application.UseCases.Permissions.Ports | ||||||
| { | { | ||||||
|     public interface IPermissionPort : IBasePort, |     public interface IPermissionPort : IBasePort, | ||||||
|         ICommandSuccessPort<PermissionAdapter>, |         ICommandSuccessPort<PermissionAdapter>, | ||||||
|         ICommandSuccessPort<List<PermissionAdapter>>, |         ICommandSuccessPort<List<PermissionAdapter>>, | ||||||
|         INoContentPort, IBusinessErrorPort, ITimeoutPort, IValidationErrorPort, |         INoContentPort, IBusinessErrorPort, ITimeoutPort, IValidationErrorPort, | ||||||
|         INotFoundPort, IForbiddenPort, IUnauthorizedPort, IInternalServerErrorPort |         INotFoundPort, IForbiddenPort, IUnauthorizedPort, IInternalServerErrorPort, | ||||||
|  |         IBadRequestPort | ||||||
|     { |     { | ||||||
|     } |     } | ||||||
| } | } | ||||||
| @@ -1,7 +1,7 @@ | |||||||
| using Core.Cerberos.Application.UseCases.Permissions.Input; | using Core.Thalos.Application.UseCases.Permissions.Input; | ||||||
| using FluentValidation; | using FluentValidation; | ||||||
| 
 | 
 | ||||||
| namespace Core.Cerberos.Application.UseCases.Permissions.Validator | namespace Core.Thalos.Application.UseCases.Permissions.Validator | ||||||
| { | { | ||||||
|     public class ChangePermissionStatusValidator : AbstractValidator<ChangePermissionStatusRequest> |     public class ChangePermissionStatusValidator : AbstractValidator<ChangePermissionStatusRequest> | ||||||
|     { |     { | ||||||
| @@ -1,7 +1,7 @@ | |||||||
| using Core.Cerberos.Application.UseCases.Permissions.Input; | using Core.Thalos.Application.UseCases.Permissions.Input; | ||||||
| using FluentValidation; | using FluentValidation; | ||||||
| 
 | 
 | ||||||
| namespace Core.Cerberos.Application.UseCases.Permissions.Validator | namespace Core.Thalos.Application.UseCases.Permissions.Validator | ||||||
| { | { | ||||||
|     public class CreatePermissionValidator : AbstractValidator<CreatePermissionRequest> |     public class CreatePermissionValidator : AbstractValidator<CreatePermissionRequest> | ||||||
|     { |     { | ||||||
| @@ -1,7 +1,7 @@ | |||||||
| using Core.Cerberos.Application.UseCases.Permissions.Input; | using Core.Thalos.Application.UseCases.Permissions.Input; | ||||||
| using FluentValidation; | using FluentValidation; | ||||||
| 
 | 
 | ||||||
| namespace Core.Cerberos.Application.UseCases.Permissions.Validator | namespace Core.Thalos.Application.UseCases.Permissions.Validator | ||||||
| { | { | ||||||
|     public class UpdatePermissionValidator : AbstractValidator<UpdatePermissionRequest> |     public class UpdatePermissionValidator : AbstractValidator<UpdatePermissionRequest> | ||||||
|     { |     { | ||||||
| @@ -1,9 +1,9 @@ | |||||||
| using Core.Cerberos.Adapters; | using Core.Thalos.Application.UseCases.Roles.Ports; | ||||||
| using Core.Cerberos.Application.UseCases.Roles.Ports; | using Core.Thalos.BuildingBlocks; | ||||||
| using Lib.Architecture.BuildingBlocks; | using Lib.Architecture.BuildingBlocks; | ||||||
| using Microsoft.AspNetCore.Mvc; | using Microsoft.AspNetCore.Mvc; | ||||||
| 
 | 
 | ||||||
| namespace Core.Cerberos.Application.UseCases.Roles.Adapter | namespace Core.Thalos.Application.UseCases.Roles.Adapter | ||||||
| { | { | ||||||
|     public class RolePort : BasePresenter, IRolePort |     public class RolePort : BasePresenter, IRolePort | ||||||
|     { |     { | ||||||
| @@ -1,7 +1,7 @@ | |||||||
| using Core.Cerberos.Adapters.Common.Enums; | using Core.Thalos.BuildingBlocks; | ||||||
| using Lib.Architecture.BuildingBlocks; | using Lib.Architecture.BuildingBlocks; | ||||||
| 
 | 
 | ||||||
| namespace Core.Cerberos.Application.UseCases.Roles.Input | namespace Core.Thalos.Application.UseCases.Roles.Input | ||||||
| { | { | ||||||
|     public class AddApplicationToRoleRequest : Notificator, ICommand |     public class AddApplicationToRoleRequest : Notificator, ICommand | ||||||
|     { |     { | ||||||
| @@ -1,7 +1,7 @@ | |||||||
| using Core.Cerberos.Adapters.Common.Enums; | using Core.Blueprint.Mongo; | ||||||
| using Lib.Architecture.BuildingBlocks; | using Lib.Architecture.BuildingBlocks; | ||||||
| 
 | 
 | ||||||
| namespace Core.Cerberos.Application.UseCases.Roles.Input | namespace Core.Thalos.Application.UseCases.Roles.Input | ||||||
| { | { | ||||||
|     public class ChangeRoleStatusRequest : Notificator, ICommand |     public class ChangeRoleStatusRequest : Notificator, ICommand | ||||||
|     { |     { | ||||||
| @@ -1,8 +1,8 @@ | |||||||
| using Core.Cerberos.Adapters.Common.Enums; | using Core.Thalos.BuildingBlocks; | ||||||
| using Lib.Architecture.BuildingBlocks; | using Lib.Architecture.BuildingBlocks; | ||||||
| using System.Text.Json.Serialization; | using System.Text.Json.Serialization; | ||||||
| 
 | 
 | ||||||
| namespace Core.Cerberos.Application.UseCases.Roles.Input | namespace Core.Thalos.Application.UseCases.Roles.Input | ||||||
| { | { | ||||||
|     public class CreateRoleRequest : Notificator, ICommand |     public class CreateRoleRequest : Notificator, ICommand | ||||||
|     { |     { | ||||||
| @@ -1,6 +1,6 @@ | |||||||
| using Lib.Architecture.BuildingBlocks; | using Lib.Architecture.BuildingBlocks; | ||||||
| 
 | 
 | ||||||
| namespace Core.Cerberos.Application.UseCases.Roles.Input | namespace Core.Thalos.Application.UseCases.Roles.Input | ||||||
| { | { | ||||||
|     public class GetAllRolesRequest : ICommand |     public class GetAllRolesRequest : ICommand | ||||||
|     { |     { | ||||||
| @@ -1,6 +1,6 @@ | |||||||
| using Lib.Architecture.BuildingBlocks; | using Lib.Architecture.BuildingBlocks; | ||||||
| 
 | 
 | ||||||
| namespace Core.Cerberos.Application.UseCases.Roles.Input | namespace Core.Thalos.Application.UseCases.Roles.Input | ||||||
| { | { | ||||||
|     public class GetRoleRequest : Notificator, ICommand |     public class GetRoleRequest : Notificator, ICommand | ||||||
|     { |     { | ||||||
| @@ -1,7 +1,7 @@ | |||||||
| using Core.Cerberos.Adapters.Common.Enums; | using Core.Thalos.BuildingBlocks; | ||||||
| using Lib.Architecture.BuildingBlocks; | using Lib.Architecture.BuildingBlocks; | ||||||
| 
 | 
 | ||||||
| namespace Core.Cerberos.Application.UseCases.Roles.Input | namespace Core.Thalos.Application.UseCases.Roles.Input | ||||||
| { | { | ||||||
|     public class RemoveApplicationFromRoleRequest : Notificator, ICommand |     public class RemoveApplicationFromRoleRequest : Notificator, ICommand | ||||||
|     { |     { | ||||||
| @@ -1,8 +1,8 @@ | |||||||
| using Core.Cerberos.Adapters.Common.Enums; | using Core.Thalos.BuildingBlocks; | ||||||
| using Lib.Architecture.BuildingBlocks; | using Lib.Architecture.BuildingBlocks; | ||||||
| using System.Text.Json.Serialization; | using System.Text.Json.Serialization; | ||||||
| 
 | 
 | ||||||
| namespace Core.Cerberos.Application.UseCases.Roles.Input | namespace Core.Thalos.Application.UseCases.Roles.Input | ||||||
| { | { | ||||||
|     public class UpdateRoleRequest : Notificator, ICommand |     public class UpdateRoleRequest : Notificator, ICommand | ||||||
|     { |     { | ||||||
| @@ -14,7 +14,7 @@ namespace Core.Cerberos.Application.UseCases.Roles.Input | |||||||
|         public ApplicationsEnum[]? Applications { get; set; } |         public ApplicationsEnum[]? Applications { get; set; } | ||||||
|         public string[] Modules { get; set; } = null!; |         public string[] Modules { get; set; } = null!; | ||||||
|         public string[] Permissions { get; set; } = null!; |         public string[] Permissions { get; set; } = null!; | ||||||
|         public StatusEnum Status { get; set; } |         public Blueprint.Mongo.StatusEnum Status { get; set; } | ||||||
| 
 | 
 | ||||||
|         public bool Validate() |         public bool Validate() | ||||||
|         { |         { | ||||||
| @@ -1,12 +1,13 @@ | |||||||
| using Core.Cerberos.Adapters; | using Core.Thalos.BuildingBlocks; | ||||||
| using Lib.Architecture.BuildingBlocks; | using Lib.Architecture.BuildingBlocks; | ||||||
| 
 | 
 | ||||||
| namespace Core.Cerberos.Application.UseCases.Roles.Ports | namespace Core.Thalos.Application.UseCases.Roles.Ports | ||||||
| { | { | ||||||
|     public interface IRolePort : IBasePort, |     public interface IRolePort : IBasePort, | ||||||
|         ICommandSuccessPort<RoleAdapter>, ICommandSuccessPort<List<RoleAdapter>>, |         ICommandSuccessPort<RoleAdapter>, ICommandSuccessPort<List<RoleAdapter>>, | ||||||
|         INoContentPort, IBusinessErrorPort, ITimeoutPort, IValidationErrorPort, |         INoContentPort, IBusinessErrorPort, ITimeoutPort, IValidationErrorPort, | ||||||
|         INotFoundPort, IForbiddenPort, IUnauthorizedPort, IInternalServerErrorPort |         INotFoundPort, IForbiddenPort, IUnauthorizedPort, IInternalServerErrorPort, | ||||||
|  |         IBadRequestPort | ||||||
|     { |     { | ||||||
|     } |     } | ||||||
| } | } | ||||||
| @@ -1,13 +1,13 @@ | |||||||
| using Core.Cerberos.Adapters; | using Core.Thalos.Application.UseCases.Roles.Input; | ||||||
| using Core.Cerberos.Application.UseCases.Roles.Input; | using Core.Thalos.Application.UseCases.Roles.Ports; | ||||||
| using Core.Cerberos.Application.UseCases.Roles.Ports; | using Core.Thalos.BuildingBlocks; | ||||||
| using Core.Cerberos.External.Clients; | using Core.Thalos.External.Clients; | ||||||
| using Core.Cerberos.External.Clients.Requests; | using Core.Thalos.External.Clients.Requests; | ||||||
| using FluentValidation; | using FluentValidation; | ||||||
| using Lib.Architecture.BuildingBlocks; | using Lib.Architecture.BuildingBlocks; | ||||||
| using Lib.Architecture.BuildingBlocks.Helpers; | using Lib.Architecture.BuildingBlocks.Helpers; | ||||||
| 
 | 
 | ||||||
| namespace Core.Cerberos.Application.UseCases.Role | namespace Core.Thalos.Application.UseCases.Role | ||||||
| { | { | ||||||
|     public class RoleHandler : |     public class RoleHandler : | ||||||
|         IComponentHandler<ChangeRoleStatusRequest>, |         IComponentHandler<ChangeRoleStatusRequest>, | ||||||
| @@ -23,20 +23,20 @@ namespace Core.Cerberos.Application.UseCases.Role | |||||||
|         private readonly IValidator<ChangeRoleStatusRequest> _changeRoleStatusValidator; |         private readonly IValidator<ChangeRoleStatusRequest> _changeRoleStatusValidator; | ||||||
|         private readonly IValidator<CreateRoleRequest> _registerRoleValidator; |         private readonly IValidator<CreateRoleRequest> _registerRoleValidator; | ||||||
|         private readonly IValidator<UpdateRoleRequest> _updateRoleValidator; |         private readonly IValidator<UpdateRoleRequest> _updateRoleValidator; | ||||||
|         private readonly ICerberosServiceClient _cerberosDALService; |         private readonly IThalosServiceClient _thalosDALService; | ||||||
| 
 | 
 | ||||||
|         public RoleHandler( |         public RoleHandler( | ||||||
|             IRolePort port, |             IRolePort port, | ||||||
|             IValidator<ChangeRoleStatusRequest> changeRoleStatusValidator, |             IValidator<ChangeRoleStatusRequest> changeRoleStatusValidator, | ||||||
|             IValidator<CreateRoleRequest> registerRoleValidator, |             IValidator<CreateRoleRequest> registerRoleValidator, | ||||||
|             IValidator<UpdateRoleRequest> updateRoleValidator, |             IValidator<UpdateRoleRequest> updateRoleValidator, | ||||||
|             ICerberosServiceClient cerberosDALService) |             IThalosServiceClient thalosDALService) | ||||||
|         { |         { | ||||||
|             _port = port ?? throw new ArgumentNullException(nameof(port)); |             _port = port ?? throw new ArgumentNullException(nameof(port)); | ||||||
|             _changeRoleStatusValidator = changeRoleStatusValidator ?? throw new ArgumentNullException(nameof(changeRoleStatusValidator)); |             _changeRoleStatusValidator = changeRoleStatusValidator ?? throw new ArgumentNullException(nameof(changeRoleStatusValidator)); | ||||||
|             _registerRoleValidator = registerRoleValidator ?? throw new ArgumentNullException(nameof(registerRoleValidator)); |             _registerRoleValidator = registerRoleValidator ?? throw new ArgumentNullException(nameof(registerRoleValidator)); | ||||||
|             _updateRoleValidator = updateRoleValidator ?? throw new ArgumentNullException(nameof(updateRoleValidator)); |             _updateRoleValidator = updateRoleValidator ?? throw new ArgumentNullException(nameof(updateRoleValidator)); | ||||||
|             _cerberosDALService = cerberosDALService ?? throw new ArgumentNullException(nameof(cerberosDALService)); |             _thalosDALService = thalosDALService ?? throw new ArgumentNullException(nameof(thalosDALService)); | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         public async ValueTask ExecuteAsync(GetRoleRequest command, CancellationToken cancellationToken = default) |         public async ValueTask ExecuteAsync(GetRoleRequest command, CancellationToken cancellationToken = default) | ||||||
| @@ -45,7 +45,7 @@ namespace Core.Cerberos.Application.UseCases.Role | |||||||
|             { |             { | ||||||
|                 ArgumentNullException.ThrowIfNull(command); |                 ArgumentNullException.ThrowIfNull(command); | ||||||
| 
 | 
 | ||||||
|                 var result = await _cerberosDALService.GetRoleByIdAsync(command.Id, cancellationToken).ConfigureAwait(false); |                 var result = await _thalosDALService.GetRoleByIdAsync(command.Id, cancellationToken).ConfigureAwait(false); | ||||||
| 
 | 
 | ||||||
|                 if (result == null) |                 if (result == null) | ||||||
|                 { |                 { | ||||||
| @@ -67,7 +67,7 @@ namespace Core.Cerberos.Application.UseCases.Role | |||||||
|             { |             { | ||||||
|                 ArgumentNullException.ThrowIfNull(command); |                 ArgumentNullException.ThrowIfNull(command); | ||||||
| 
 | 
 | ||||||
|                 var _result = await _cerberosDALService.GetAllRolesAsync().ConfigureAwait(false); |                 var _result = await _thalosDALService.GetAllRolesAsync().ConfigureAwait(false); | ||||||
|                 if (!_result.Any()) |                 if (!_result.Any()) | ||||||
|                 { |                 { | ||||||
|                     _port.NoContentSuccess(); |                     _port.NoContentSuccess(); | ||||||
| @@ -93,7 +93,7 @@ namespace Core.Cerberos.Application.UseCases.Role | |||||||
|                     return; |                     return; | ||||||
|                 } |                 } | ||||||
| 
 | 
 | ||||||
|                 var result = await _cerberosDALService.ChangeRoleStatusAsync(command.Id, command.Status, cancellationToken).ConfigureAwait(false); |                 var result = await _thalosDALService.ChangeRoleStatusAsync(command.Id, command.Status, cancellationToken).ConfigureAwait(false); | ||||||
| 
 | 
 | ||||||
|                 if (result == null) |                 if (result == null) | ||||||
|                 { |                 { | ||||||
| @@ -131,7 +131,7 @@ namespace Core.Cerberos.Application.UseCases.Role | |||||||
| 
 | 
 | ||||||
|                 }; |                 }; | ||||||
| 
 | 
 | ||||||
|                 var result = await _cerberosDALService.CreateRoleAsync(request, cancellationToken).ConfigureAwait(false); |                 var result = await _thalosDALService.CreateRoleAsync(request, cancellationToken).ConfigureAwait(false); | ||||||
| 
 | 
 | ||||||
|                 if (result == null) |                 if (result == null) | ||||||
|                 { |                 { | ||||||
| @@ -166,13 +166,12 @@ namespace Core.Cerberos.Application.UseCases.Role | |||||||
|                     Description = command.Description, |                     Description = command.Description, | ||||||
|                     Applications = command.Applications, |                     Applications = command.Applications, | ||||||
|                     Modules = command.Modules, |                     Modules = command.Modules, | ||||||
|                     Permissions = command.Permissions, |                     Permissions = command.Permissions | ||||||
|                     Status = command.Status |  | ||||||
|                 }; |                 }; | ||||||
| 
 | 
 | ||||||
|                 string id = command.Id; |                 string id = command.Id; | ||||||
| 
 | 
 | ||||||
|                 var result = await _cerberosDALService.UpdateRoleAsync(request, id, cancellationToken).ConfigureAwait(false); |                 var result = await _thalosDALService.UpdateRoleAsync(request, id, cancellationToken).ConfigureAwait(false); | ||||||
| 
 | 
 | ||||||
|                 if (result == null) |                 if (result == null) | ||||||
|                 { |                 { | ||||||
| @@ -194,7 +193,7 @@ namespace Core.Cerberos.Application.UseCases.Role | |||||||
|             { |             { | ||||||
|                 ArgumentNullException.ThrowIfNull(command); |                 ArgumentNullException.ThrowIfNull(command); | ||||||
| 
 | 
 | ||||||
|                 var result = await _cerberosDALService.AddApplicationToRoleAsync(command.RoleId, command.Application, cancellationToken).ConfigureAwait(false); |                 var result = await _thalosDALService.AddApplicationToRoleAsync(command.RoleId, command.Application, cancellationToken).ConfigureAwait(false); | ||||||
| 
 | 
 | ||||||
|                 if (result == null) |                 if (result == null) | ||||||
|                 { |                 { | ||||||
| @@ -216,7 +215,7 @@ namespace Core.Cerberos.Application.UseCases.Role | |||||||
|             { |             { | ||||||
|                 ArgumentNullException.ThrowIfNull(command); |                 ArgumentNullException.ThrowIfNull(command); | ||||||
| 
 | 
 | ||||||
|                 var result = await _cerberosDALService.RemoveApplicationToRoleAsync(command.RoleId, command.Application, cancellationToken).ConfigureAwait(false); |                 var result = await _thalosDALService.RemoveApplicationToRoleAsync(command.RoleId, command.Application, cancellationToken).ConfigureAwait(false); | ||||||
| 
 | 
 | ||||||
|                 if (result == null) |                 if (result == null) | ||||||
|                 { |                 { | ||||||
| @@ -1,7 +1,7 @@ | |||||||
| using Core.Cerberos.Application.UseCases.Roles.Input; | using Core.Thalos.Application.UseCases.Roles.Input; | ||||||
| using FluentValidation; | using FluentValidation; | ||||||
| 
 | 
 | ||||||
| namespace Core.Cerberos.Application.UseCases.Roles.Validator | namespace Core.Thalos.Application.UseCases.Roles.Validator | ||||||
| { | { | ||||||
|     public class ChangeRoleStatusValidator : AbstractValidator<ChangeRoleStatusRequest> |     public class ChangeRoleStatusValidator : AbstractValidator<ChangeRoleStatusRequest> | ||||||
|     { |     { | ||||||
| @@ -1,7 +1,7 @@ | |||||||
| using Core.Cerberos.Application.UseCases.Roles.Input; | using Core.Thalos.Application.UseCases.Roles.Input; | ||||||
| using FluentValidation; | using FluentValidation; | ||||||
| 
 | 
 | ||||||
| namespace Core.Cerberos.Application.UseCases.Roles.Validator | namespace Core.Thalos.Application.UseCases.Roles.Validator | ||||||
| { | { | ||||||
|     public class CreateRoleValidator : AbstractValidator<CreateRoleRequest> |     public class CreateRoleValidator : AbstractValidator<CreateRoleRequest> | ||||||
|     { |     { | ||||||
| @@ -1,7 +1,7 @@ | |||||||
| using Core.Cerberos.Application.UseCases.Roles.Input; | using Core.Thalos.Application.UseCases.Roles.Input; | ||||||
| using FluentValidation; | using FluentValidation; | ||||||
| 
 | 
 | ||||||
| namespace Core.Cerberos.Application.UseCases.Roles.Validator | namespace Core.Thalos.Application.UseCases.Roles.Validator | ||||||
| { | { | ||||||
|     public class UpdateRoleValidator : AbstractValidator<UpdateRoleRequest> |     public class UpdateRoleValidator : AbstractValidator<UpdateRoleRequest> | ||||||
|     { |     { | ||||||
| @@ -1,10 +1,10 @@ | |||||||
| using Core.Blueprint.Storage.Adapters; | using Core.Blueprint.Storage.Adapters; | ||||||
| using Core.Cerberos.Adapters; | using Core.Thalos.Application.UseCases.Users.Ports; | ||||||
| using Core.Cerberos.Application.UseCases.Users.Ports; | using Core.Thalos.BuildingBlocks; | ||||||
| using Lib.Architecture.BuildingBlocks; | using Lib.Architecture.BuildingBlocks; | ||||||
| using Microsoft.AspNetCore.Mvc; | using Microsoft.AspNetCore.Mvc; | ||||||
| 
 | 
 | ||||||
| namespace Core.Cerberos.Application.UseCases.Users.Adapter | namespace Core.Thalos.Application.UseCases.Users.Adapter | ||||||
| { | { | ||||||
|     public class UserPort : BasePresenter, IUserPort |     public class UserPort : BasePresenter, IUserPort | ||||||
|     { |     { | ||||||
| @@ -1,7 +1,7 @@ | |||||||
| using Core.Cerberos.Adapters.Common.Enums; | using Core.Blueprint.Mongo; | ||||||
| using Lib.Architecture.BuildingBlocks; | using Lib.Architecture.BuildingBlocks; | ||||||
| 
 | 
 | ||||||
| namespace Core.Cerberos.Application.UseCases.Users.Input | namespace Core.Thalos.Application.UseCases.Users.Input | ||||||
| { | { | ||||||
|     public class ChangeUserStatusRequest : Notificator, ICommand |     public class ChangeUserStatusRequest : Notificator, ICommand | ||||||
|     { |     { | ||||||
| @@ -1,6 +1,6 @@ | |||||||
| using Lib.Architecture.BuildingBlocks; | using Lib.Architecture.BuildingBlocks; | ||||||
| 
 | 
 | ||||||
| namespace Core.Cerberos.Application.UseCases.Users.Input | namespace Core.Thalos.Application.UseCases.Users.Input | ||||||
| { | { | ||||||
|     public class CreateUserRequest : Notificator, ICommand |     public class CreateUserRequest : Notificator, ICommand | ||||||
|     { |     { | ||||||
| @@ -1,6 +1,6 @@ | |||||||
| using Lib.Architecture.BuildingBlocks; | using Lib.Architecture.BuildingBlocks; | ||||||
| 
 | 
 | ||||||
| namespace Core.Cerberos.Application.UseCases.Users.Input | namespace Core.Thalos.Application.UseCases.Users.Input | ||||||
| { | { | ||||||
|     public class GetAllUsersRequest : ICommand |     public class GetAllUsersRequest : ICommand | ||||||
|     { |     { | ||||||
| @@ -1,6 +1,6 @@ | |||||||
| using Lib.Architecture.BuildingBlocks; | using Lib.Architecture.BuildingBlocks; | ||||||
| 
 | 
 | ||||||
| namespace Core.Cerberos.Application.UseCases.Users.Input | namespace Core.Thalos.Application.UseCases.Users.Input | ||||||
| { | { | ||||||
|     public class GetTokenAdapterRequest : Notificator, ICommand |     public class GetTokenAdapterRequest : Notificator, ICommand | ||||||
|     { |     { | ||||||
| @@ -1,6 +1,6 @@ | |||||||
| using Lib.Architecture.BuildingBlocks; | using Lib.Architecture.BuildingBlocks; | ||||||
| 
 | 
 | ||||||
| namespace Core.Cerberos.Application.UseCases.Users.Input | namespace Core.Thalos.Application.UseCases.Users.Input | ||||||
| { | { | ||||||
|     public class GetUserByEmailRequest : Notificator, ICommand |     public class GetUserByEmailRequest : Notificator, ICommand | ||||||
|     { |     { | ||||||
| @@ -1,6 +1,6 @@ | |||||||
| using Lib.Architecture.BuildingBlocks; | using Lib.Architecture.BuildingBlocks; | ||||||
| 
 | 
 | ||||||
| namespace Core.Cerberos.Application.UseCases.Users.Input | namespace Core.Thalos.Application.UseCases.Users.Input | ||||||
| { | { | ||||||
|     public class GetUserRequest : Notificator, ICommand |     public class GetUserRequest : Notificator, ICommand | ||||||
|     { |     { | ||||||
| @@ -1,6 +1,6 @@ | |||||||
| using Lib.Architecture.BuildingBlocks; | using Lib.Architecture.BuildingBlocks; | ||||||
| 
 | 
 | ||||||
| namespace Core.Cerberos.Application.UseCases.Users.Input | namespace Core.Thalos.Application.UseCases.Users.Input | ||||||
| { | { | ||||||
|     public class LoginUserRequest : Notificator, ICommand |     public class LoginUserRequest : Notificator, ICommand | ||||||
|     { |     { | ||||||
| @@ -1,6 +1,6 @@ | |||||||
| using Lib.Architecture.BuildingBlocks; | using Lib.Architecture.BuildingBlocks; | ||||||
| 
 | 
 | ||||||
| namespace Core.Cerberos.Application.UseCases.Users.Input | namespace Core.Thalos.Application.UseCases.Users.Input | ||||||
| { | { | ||||||
|     public class LogoutUserRequest : Notificator, ICommand |     public class LogoutUserRequest : Notificator, ICommand | ||||||
|     { |     { | ||||||
| @@ -1,6 +1,6 @@ | |||||||
| using Lib.Architecture.BuildingBlocks; | using Lib.Architecture.BuildingBlocks; | ||||||
| 
 | 
 | ||||||
| namespace Core.Cerberos.Application.UseCases.Users.Input | namespace Core.Thalos.Application.UseCases.Users.Input | ||||||
| { | { | ||||||
|     public class UpdateUserRequest : Notificator, ICommand |     public class UpdateUserRequest : Notificator, ICommand | ||||||
|     { |     { | ||||||
| @@ -1,6 +1,6 @@ | |||||||
| using Lib.Architecture.BuildingBlocks; | using Lib.Architecture.BuildingBlocks; | ||||||
| 
 | 
 | ||||||
| namespace Core.Cerberos.Application.UseCases.Users.Input | namespace Core.Thalos.Application.UseCases.Users.Input | ||||||
| { | { | ||||||
|     public class ValidateUserExistenceRequest : Notificator, ICommand |     public class ValidateUserExistenceRequest : Notificator, ICommand | ||||||
|     { |     { | ||||||
| @@ -1,8 +1,8 @@ | |||||||
| using Core.Blueprint.Storage.Adapters; | using Core.Blueprint.Storage.Adapters; | ||||||
| using Core.Cerberos.Adapters; | using Core.Thalos.BuildingBlocks; | ||||||
| using Lib.Architecture.BuildingBlocks; | using Lib.Architecture.BuildingBlocks; | ||||||
| 
 | 
 | ||||||
| namespace Core.Cerberos.Application.UseCases.Users.Ports | namespace Core.Thalos.Application.UseCases.Users.Ports | ||||||
| { | { | ||||||
|     public interface IUserPort : IBasePort, |     public interface IUserPort : IBasePort, | ||||||
|         ICommandSuccessPort<UserAdapter>, |         ICommandSuccessPort<UserAdapter>, | ||||||
| @@ -11,7 +11,8 @@ namespace Core.Cerberos.Application.UseCases.Users.Ports | |||||||
|         ICommandSuccessPort<TokenAdapter>, |         ICommandSuccessPort<TokenAdapter>, | ||||||
|         ICommandSuccessPort<BlobDownloadUriAdapter>, |         ICommandSuccessPort<BlobDownloadUriAdapter>, | ||||||
|         INoContentPort, IBusinessErrorPort, ITimeoutPort, IValidationErrorPort, |         INoContentPort, IBusinessErrorPort, ITimeoutPort, IValidationErrorPort, | ||||||
|         INotFoundPort, IForbiddenPort, IUnauthorizedPort, IInternalServerErrorPort |         INotFoundPort, IForbiddenPort, IUnauthorizedPort, IInternalServerErrorPort, | ||||||
|  |         IBadRequestPort | ||||||
|     { |     { | ||||||
|     } |     } | ||||||
| } | } | ||||||
| @@ -1,12 +1,12 @@ | |||||||
| using Core.Cerberos.Adapters; | using Core.Thalos.Application.UseCases.Users.Input; | ||||||
| using Core.Cerberos.Application.UseCases.Users.Input; | using Core.Thalos.Application.UseCases.Users.Ports; | ||||||
| using Core.Cerberos.Application.UseCases.Users.Ports; | using Core.Thalos.BuildingBlocks; | ||||||
| using Core.Cerberos.External.Clients; | using Core.Thalos.External.Clients; | ||||||
| using Core.Cerberos.External.Clients.Requests; | using Core.Thalos.External.Clients.Requests; | ||||||
| using FluentValidation; | using FluentValidation; | ||||||
| using Lib.Architecture.BuildingBlocks; | using Lib.Architecture.BuildingBlocks; | ||||||
| using Lib.Architecture.BuildingBlocks.Helpers; | using Lib.Architecture.BuildingBlocks.Helpers; | ||||||
| namespace Core.Cerberos.Application.UseCases.Users | namespace Core.Thalos.Application.UseCases.Users | ||||||
| { | { | ||||||
|     public class UserHandler : |     public class UserHandler : | ||||||
|         IComponentHandler<ChangeUserStatusRequest>, |         IComponentHandler<ChangeUserStatusRequest>, | ||||||
| @@ -15,35 +15,29 @@ namespace Core.Cerberos.Application.UseCases.Users | |||||||
|         IComponentHandler<GetUserRequest>, |         IComponentHandler<GetUserRequest>, | ||||||
|         IComponentHandler<GetUserByEmailRequest>, |         IComponentHandler<GetUserByEmailRequest>, | ||||||
|         IComponentHandler<CreateUserRequest>, |         IComponentHandler<CreateUserRequest>, | ||||||
|         IComponentHandler<AddProjectToUserRequest>, |  | ||||||
|         IComponentHandler<RemoveProjectFromUserRequest>, |  | ||||||
|         IComponentHandler<AddCompanyToUserRequest>, |  | ||||||
|         IComponentHandler<RemoveCompanyFromUserRequest>, |  | ||||||
|         IComponentHandler<LoginUserRequest>, |         IComponentHandler<LoginUserRequest>, | ||||||
|         IComponentHandler<LogoutUserRequest>, |         IComponentHandler<LogoutUserRequest>, | ||||||
|         IComponentHandler<ValidateUserExistenceRequest>, |         IComponentHandler<ValidateUserExistenceRequest>, | ||||||
|         IComponentHandler<GetTokenAdapterRequest>, |         IComponentHandler<GetTokenAdapterRequest> | ||||||
|         IComponentHandler<GetConsentFormPDFRequest>, |  | ||||||
|         IComponentHandler<AcceptUserConsentFormRequest> |  | ||||||
|     { |     { | ||||||
|         private readonly IUserPort _port; |         private readonly IUserPort _port; | ||||||
|         private readonly IValidator<ChangeUserStatusRequest> _changeUserStatusValidator; |         private readonly IValidator<ChangeUserStatusRequest> _changeUserStatusValidator; | ||||||
|         private readonly IValidator<CreateUserRequest> _registerUserValidator; |         private readonly IValidator<CreateUserRequest> _registerUserValidator; | ||||||
|         private readonly IValidator<UpdateUserRequest> _updateUserValidator; |         private readonly IValidator<UpdateUserRequest> _updateUserValidator; | ||||||
|         private readonly ICerberosServiceClient _cerberosDALService; |         private readonly IThalosServiceClient _thalosDALService; | ||||||
| 
 | 
 | ||||||
|         public UserHandler( |         public UserHandler( | ||||||
|             IUserPort port, |             IUserPort port, | ||||||
|             IValidator<ChangeUserStatusRequest> changeUserStatusValidator, |             IValidator<ChangeUserStatusRequest> changeUserStatusValidator, | ||||||
|             IValidator<CreateUserRequest> registerUserValidator, |             IValidator<CreateUserRequest> registerUserValidator, | ||||||
|             IValidator<UpdateUserRequest> updateUserValidator, |             IValidator<UpdateUserRequest> updateUserValidator, | ||||||
|             ICerberosServiceClient cerberosDALService) |             IThalosServiceClient thalosDALService) | ||||||
|         { |         { | ||||||
|             _port = port ?? throw new ArgumentNullException(nameof(port)); |             _port = port ?? throw new ArgumentNullException(nameof(port)); | ||||||
|             _changeUserStatusValidator = changeUserStatusValidator ?? throw new ArgumentNullException(nameof(changeUserStatusValidator)); |             _changeUserStatusValidator = changeUserStatusValidator ?? throw new ArgumentNullException(nameof(changeUserStatusValidator)); | ||||||
|             _registerUserValidator = registerUserValidator ?? throw new ArgumentNullException(nameof(registerUserValidator)); |             _registerUserValidator = registerUserValidator ?? throw new ArgumentNullException(nameof(registerUserValidator)); | ||||||
|             _updateUserValidator = updateUserValidator ?? throw new ArgumentNullException(nameof(updateUserValidator)); |             _updateUserValidator = updateUserValidator ?? throw new ArgumentNullException(nameof(updateUserValidator)); | ||||||
|             _cerberosDALService = cerberosDALService ?? throw new ArgumentNullException(nameof(cerberosDALService)); |             _thalosDALService = thalosDALService ?? throw new ArgumentNullException(nameof(thalosDALService)); | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         public async ValueTask ExecuteAsync(GetUserRequest command, CancellationToken cancellationToken = default) |         public async ValueTask ExecuteAsync(GetUserRequest command, CancellationToken cancellationToken = default) | ||||||
| @@ -52,7 +46,7 @@ namespace Core.Cerberos.Application.UseCases.Users | |||||||
|             { |             { | ||||||
|                 ArgumentNullException.ThrowIfNull(command); |                 ArgumentNullException.ThrowIfNull(command); | ||||||
| 
 | 
 | ||||||
|                 var result = await _cerberosDALService.GetUserByIdAsync(command.Id, cancellationToken).ConfigureAwait(false); |                 var result = await _thalosDALService.GetUserByIdAsync(command.Id, cancellationToken).ConfigureAwait(false); | ||||||
| 
 | 
 | ||||||
|                 if (result == null) |                 if (result == null) | ||||||
|                 { |                 { | ||||||
| @@ -74,7 +68,7 @@ namespace Core.Cerberos.Application.UseCases.Users | |||||||
|             { |             { | ||||||
|                 ArgumentNullException.ThrowIfNull(command); |                 ArgumentNullException.ThrowIfNull(command); | ||||||
| 
 | 
 | ||||||
|                 var result = await _cerberosDALService.GetUserByEmailAsync(command.Email, cancellationToken).ConfigureAwait(false); |                 var result = await _thalosDALService.GetUserByEmailAsync(command.Email, cancellationToken).ConfigureAwait(false); | ||||||
| 
 | 
 | ||||||
|                 if (result == null) |                 if (result == null) | ||||||
|                 { |                 { | ||||||
| @@ -96,7 +90,7 @@ namespace Core.Cerberos.Application.UseCases.Users | |||||||
|             { |             { | ||||||
|                 ArgumentNullException.ThrowIfNull(command); |                 ArgumentNullException.ThrowIfNull(command); | ||||||
| 
 | 
 | ||||||
|                 var result = await _cerberosDALService.ValidateUserExistence(command.Email, cancellationToken).ConfigureAwait(false); |                 var result = await _thalosDALService.ValidateUserExistence(command.Email, cancellationToken).ConfigureAwait(false); | ||||||
| 
 | 
 | ||||||
|                 if (result == null) |                 if (result == null) | ||||||
|                 { |                 { | ||||||
| @@ -118,7 +112,7 @@ namespace Core.Cerberos.Application.UseCases.Users | |||||||
|             { |             { | ||||||
|                 ArgumentNullException.ThrowIfNull(command); |                 ArgumentNullException.ThrowIfNull(command); | ||||||
| 
 | 
 | ||||||
|                 var _result = await _cerberosDALService.GetAllUsersAsync().ConfigureAwait(false); |                 var _result = await _thalosDALService.GetAllUsersAsync().ConfigureAwait(false); | ||||||
|                 if (!_result.Any()) |                 if (!_result.Any()) | ||||||
|                 { |                 { | ||||||
|                     _port.NoContentSuccess(); |                     _port.NoContentSuccess(); | ||||||
| @@ -144,7 +138,7 @@ namespace Core.Cerberos.Application.UseCases.Users | |||||||
|                     return; |                     return; | ||||||
|                 } |                 } | ||||||
| 
 | 
 | ||||||
|                 var result = await _cerberosDALService.ChangeUserStatusAsync(command.Id, command.Status, cancellationToken).ConfigureAwait(false); |                 var result = await _thalosDALService.ChangeUserStatusAsync(command.Id, command.Status, cancellationToken).ConfigureAwait(false); | ||||||
| 
 | 
 | ||||||
|                 if (result == null) |                 if (result == null) | ||||||
|                 { |                 { | ||||||
| @@ -179,11 +173,9 @@ namespace Core.Cerberos.Application.UseCases.Users | |||||||
|                     MiddleName = command.MiddleName, |                     MiddleName = command.MiddleName, | ||||||
|                     LastName = command.LastName, |                     LastName = command.LastName, | ||||||
|                     RoleId = command.RoleId, |                     RoleId = command.RoleId, | ||||||
|                     Companies = command.Companies, |  | ||||||
|                     Projects = command.Projects, |  | ||||||
|                 }; |                 }; | ||||||
| 
 | 
 | ||||||
|                 var result = await _cerberosDALService.CreateUserAsync(request, command.SendInvitation, cancellationToken).ConfigureAwait(false); |                 var result = await _thalosDALService.CreateUserAsync(request, command.SendInvitation, cancellationToken).ConfigureAwait(false); | ||||||
| 
 | 
 | ||||||
|                 if (result == null) |                 if (result == null) | ||||||
|                 { |                 { | ||||||
| @@ -219,11 +211,9 @@ namespace Core.Cerberos.Application.UseCases.Users | |||||||
|                     MiddleName = command.MiddleName, |                     MiddleName = command.MiddleName, | ||||||
|                     LastName = command.LastName, |                     LastName = command.LastName, | ||||||
|                     RoleId = command.RoleId, |                     RoleId = command.RoleId, | ||||||
|                     Companies = command.Companies, |  | ||||||
|                     Projects = command.Projects |  | ||||||
|                 }; |                 }; | ||||||
| 
 | 
 | ||||||
|                 var result = await _cerberosDALService.UpdateUserAsync(request, request.Id, cancellationToken).ConfigureAwait(false); |                 var result = await _thalosDALService.UpdateUserAsync(request, request.Id, cancellationToken).ConfigureAwait(false); | ||||||
| 
 | 
 | ||||||
|                 if (result == null) |                 if (result == null) | ||||||
|                 { |                 { | ||||||
| @@ -245,7 +235,7 @@ namespace Core.Cerberos.Application.UseCases.Users | |||||||
|             { |             { | ||||||
|                 ArgumentNullException.ThrowIfNull(command); |                 ArgumentNullException.ThrowIfNull(command); | ||||||
| 
 | 
 | ||||||
|                 var result = await _cerberosDALService.LoginUserAsync(command.Email, cancellationToken).ConfigureAwait(false); |                 var result = await _thalosDALService.LoginUserAsync(command.Email, cancellationToken).ConfigureAwait(false); | ||||||
| 
 | 
 | ||||||
|                 if (result == null) |                 if (result == null) | ||||||
|                 { |                 { | ||||||
| @@ -267,95 +257,7 @@ namespace Core.Cerberos.Application.UseCases.Users | |||||||
|             { |             { | ||||||
|                 ArgumentNullException.ThrowIfNull(command); |                 ArgumentNullException.ThrowIfNull(command); | ||||||
| 
 | 
 | ||||||
|                 var result = await _cerberosDALService.LogoutUserAsync(command.Email, cancellationToken).ConfigureAwait(false); |                 var result = await _thalosDALService.LogoutUserAsync(command.Email, cancellationToken).ConfigureAwait(false); | ||||||
| 
 |  | ||||||
|                 if (result == null) |  | ||||||
|                 { |  | ||||||
|                     _port.NoContentSuccess(); |  | ||||||
|                     return; |  | ||||||
|                 } |  | ||||||
| 
 |  | ||||||
|                 _port.Success(result); |  | ||||||
|             } |  | ||||||
|             catch (Exception ex) |  | ||||||
|             { |  | ||||||
|                 ApiResponseHelper.EvaluatePort(ex, _port); |  | ||||||
|             } |  | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|         public async ValueTask ExecuteAsync(AddCompanyToUserRequest command, CancellationToken cancellationToken = default) |  | ||||||
|         { |  | ||||||
|             try |  | ||||||
|             { |  | ||||||
|                 ArgumentNullException.ThrowIfNull(command); |  | ||||||
| 
 |  | ||||||
|                 var result = await _cerberosDALService.AddCompanyToUserAsync(command.UserId, command.CompanyId, cancellationToken).ConfigureAwait(false); |  | ||||||
| 
 |  | ||||||
|                 if (result == null) |  | ||||||
|                 { |  | ||||||
|                     _port.NoContentSuccess(); |  | ||||||
|                     return; |  | ||||||
|                 } |  | ||||||
| 
 |  | ||||||
|                 _port.Success(result); |  | ||||||
|             } |  | ||||||
|             catch (Exception ex) |  | ||||||
|             { |  | ||||||
|                 ApiResponseHelper.EvaluatePort(ex, _port); |  | ||||||
|             } |  | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|         public async ValueTask ExecuteAsync(RemoveCompanyFromUserRequest command, CancellationToken cancellationToken = default) |  | ||||||
|         { |  | ||||||
|             try |  | ||||||
|             { |  | ||||||
|                 ArgumentNullException.ThrowIfNull(command); |  | ||||||
| 
 |  | ||||||
|                 var result = await _cerberosDALService.RemoveCompanyToUserAsync(command.UserId, command.CompanyId, cancellationToken).ConfigureAwait(false); |  | ||||||
| 
 |  | ||||||
|                 if (result == null) |  | ||||||
|                 { |  | ||||||
|                     _port.NoContentSuccess(); |  | ||||||
|                     return; |  | ||||||
|                 } |  | ||||||
| 
 |  | ||||||
|                 _port.Success(result); |  | ||||||
|             } |  | ||||||
|             catch (Exception ex) |  | ||||||
|             { |  | ||||||
|                 ApiResponseHelper.EvaluatePort(ex, _port); |  | ||||||
|             } |  | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|         public async ValueTask ExecuteAsync(AddProjectToUserRequest command, CancellationToken cancellationToken = default) |  | ||||||
|         { |  | ||||||
|             try |  | ||||||
|             { |  | ||||||
|                 ArgumentNullException.ThrowIfNull(command); |  | ||||||
| 
 |  | ||||||
|                 var result = await _cerberosDALService.AddProjectToUserAsync(command.UserId, command.ProjectId, cancellationToken).ConfigureAwait(false); |  | ||||||
| 
 |  | ||||||
|                 if (result == null) |  | ||||||
|                 { |  | ||||||
|                     _port.NoContentSuccess(); |  | ||||||
|                     return; |  | ||||||
|                 } |  | ||||||
| 
 |  | ||||||
|                 _port.Success(result); |  | ||||||
|             } |  | ||||||
|             catch (Exception ex) |  | ||||||
|             { |  | ||||||
|                 ApiResponseHelper.EvaluatePort(ex, _port); |  | ||||||
|             } |  | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|         public async ValueTask ExecuteAsync(RemoveProjectFromUserRequest command, CancellationToken cancellationToken = default) |  | ||||||
|         { |  | ||||||
|             try |  | ||||||
|             { |  | ||||||
|                 ArgumentNullException.ThrowIfNull(command); |  | ||||||
| 
 |  | ||||||
|                 var result = await _cerberosDALService.RemoveProjectToUserAsync(command.UserId, command.ProjectId, cancellationToken).ConfigureAwait(false); |  | ||||||
| 
 | 
 | ||||||
|                 if (result == null) |                 if (result == null) | ||||||
|                 { |                 { | ||||||
| @@ -377,51 +279,9 @@ namespace Core.Cerberos.Application.UseCases.Users | |||||||
|             { |             { | ||||||
|                 ArgumentNullException.ThrowIfNull(command); |                 ArgumentNullException.ThrowIfNull(command); | ||||||
| 
 | 
 | ||||||
|                 var result = await _cerberosDALService.GetTokenAdapter(command.Email, cancellationToken).ConfigureAwait(false); |                 var result = await _thalosDALService.GetTokenAdapter(command.Email, cancellationToken).ConfigureAwait(false); | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|                 if (result == null) |  | ||||||
|                 { |  | ||||||
|                     _port.NoContentSuccess(); |  | ||||||
|                     return; |  | ||||||
|                 } |  | ||||||
| 
 |  | ||||||
|                 _port.Success(result); |  | ||||||
|             } |  | ||||||
|             catch (Exception ex) |  | ||||||
|             { |  | ||||||
|                 ApiResponseHelper.EvaluatePort(ex, _port); |  | ||||||
|             } |  | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|         public async ValueTask ExecuteAsync(GetConsentFormPDFRequest command, CancellationToken cancellationToken = default) |  | ||||||
|         { |  | ||||||
|             try |  | ||||||
|             { |  | ||||||
|                 ArgumentNullException.ThrowIfNull(command); |  | ||||||
| 
 |  | ||||||
|                 var _result = await _cerberosDALService.GetConsentFormPDFAsync(cancellationToken).ConfigureAwait(false); |  | ||||||
|                 if (_result == null) |  | ||||||
|                 { |  | ||||||
|                     _port.NoContentSuccess(); |  | ||||||
|                     return; |  | ||||||
|                 } |  | ||||||
|                 _port.Success(_result); |  | ||||||
|             } |  | ||||||
|             catch (Exception ex) |  | ||||||
|             { |  | ||||||
|                 ApiResponseHelper.EvaluatePort(ex, _port); |  | ||||||
|             } |  | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|         public async ValueTask ExecuteAsync(AcceptUserConsentFormRequest command, CancellationToken cancellationToken = default) |  | ||||||
|         { |  | ||||||
|             try |  | ||||||
|             { |  | ||||||
|                 ArgumentNullException.ThrowIfNull(command); |  | ||||||
| 
 |  | ||||||
|                 var result = await _cerberosDALService.AcceptUserConsentFormAsync(cancellationToken).ConfigureAwait(false); |  | ||||||
| 
 |  | ||||||
|                 if (result == null) |                 if (result == null) | ||||||
|                 { |                 { | ||||||
|                     _port.NoContentSuccess(); |                     _port.NoContentSuccess(); | ||||||
| @@ -1,7 +1,7 @@ | |||||||
| using Core.Cerberos.Application.UseCases.Users.Input; | using Core.Thalos.Application.UseCases.Users.Input; | ||||||
| using FluentValidation; | using FluentValidation; | ||||||
| 
 | 
 | ||||||
| namespace Core.Cerberos.Application.UseCases.Users.Validator | namespace Core.Thalos.Application.UseCases.Users.Validator | ||||||
| { | { | ||||||
|     public class ChangeUserStatusValidator : AbstractValidator<ChangeUserStatusRequest> |     public class ChangeUserStatusValidator : AbstractValidator<ChangeUserStatusRequest> | ||||||
|     { |     { | ||||||
| @@ -1,7 +1,7 @@ | |||||||
| using Core.Cerberos.Application.UseCases.Users.Input; | using Core.Thalos.Application.UseCases.Users.Input; | ||||||
| using FluentValidation; | using FluentValidation; | ||||||
| 
 | 
 | ||||||
| namespace Core.Cerberos.Application.UseCases.Users.Validator | namespace Core.Thalos.Application.UseCases.Users.Validator | ||||||
| { | { | ||||||
|     public class CreateUserValidator : AbstractValidator<CreateUserRequest> |     public class CreateUserValidator : AbstractValidator<CreateUserRequest> | ||||||
|     { |     { | ||||||
| @@ -1,7 +1,7 @@ | |||||||
| using Core.Cerberos.Application.UseCases.Users.Input; | using Core.Thalos.Application.UseCases.Users.Input; | ||||||
| using FluentValidation; | using FluentValidation; | ||||||
| 
 | 
 | ||||||
| namespace Core.Cerberos.Application.UseCases.Users.Validator | namespace Core.Thalos.Application.UseCases.Users.Validator | ||||||
| { | { | ||||||
|     public class UpdateUserValidator : AbstractValidator<UpdateUserRequest> |     public class UpdateUserValidator : AbstractValidator<UpdateUserRequest> | ||||||
|     { |     { | ||||||
| @@ -1,6 +1,6 @@ | |||||||
| using Core.Cerberos.External.Clients; | using Core.Thalos.External.Clients; | ||||||
| using Core.Cerberos.External.GatewayConfigurations; | using Core.Thalos.External.GatewayConfigurations; | ||||||
| using Core.Cerberos.External.Helpers.Token; | using Core.Thalos.External.Helpers.Token; | ||||||
| using Lib.Architecture.BuildingBlocks; | using Lib.Architecture.BuildingBlocks; | ||||||
| using Microsoft.AspNetCore.Authentication; | using Microsoft.AspNetCore.Authentication; | ||||||
| using Microsoft.AspNetCore.Http; | using Microsoft.AspNetCore.Http; | ||||||
| @@ -8,7 +8,7 @@ using Microsoft.Extensions.Configuration; | |||||||
| using Microsoft.Extensions.DependencyInjection; | using Microsoft.Extensions.DependencyInjection; | ||||||
| using Refit; | using Refit; | ||||||
| 
 | 
 | ||||||
| namespace Core.Cerberos.External.ClientConfiguration | namespace Core.Thalos.External.ClientConfiguration | ||||||
| { | { | ||||||
|     public static class RegisterClientConfiguration |     public static class RegisterClientConfiguration | ||||||
|     { |     { | ||||||
| @@ -37,18 +37,18 @@ namespace Core.Cerberos.External.ClientConfiguration | |||||||
|                 return handler; |                 return handler; | ||||||
|             }); |             }); | ||||||
| 
 | 
 | ||||||
|             var cerberosServiceApiUrl = GatewaySettingsConfigurations.GetCerberosServiceAPIEndpoint().Endpoint.Url; |             var thalosServiceApiUrl = GatewaySettingsConfigurations.GetThalosServiceAPIEndpoint().Endpoint.Url; | ||||||
| 
 | 
 | ||||||
|             // Register ICerberosServiceClient with the manually created HttpClient |             // Register IThalosServiceClient with the manually created HttpClient | ||||||
|             services.AddScoped<ICerberosServiceClient>(provider => |             services.AddScoped<IThalosServiceClient>(provider => | ||||||
|             { |             { | ||||||
|                 var handler = provider.GetRequiredService<AuthenticatedHttpClientHandler>(); |                 var handler = provider.GetRequiredService<AuthenticatedHttpClientHandler>(); | ||||||
|                 var httpClient = new HttpClient(handler) |                 var httpClient = new HttpClient(handler) | ||||||
|                 { |                 { | ||||||
|                     BaseAddress = new Uri(cerberosServiceApiUrl), |                     BaseAddress = new Uri(thalosServiceApiUrl), | ||||||
|                     Timeout = TimeSpan.FromMinutes(1) |                     Timeout = TimeSpan.FromMinutes(1) | ||||||
|                 }; |                 }; | ||||||
|                 return RestService.For<ICerberosServiceClient>(httpClient); |                 return RestService.For<IThalosServiceClient>(httpClient); | ||||||
|             }); |             }); | ||||||
| 
 | 
 | ||||||
|             services.AddScoped<IAuthenticationService, AuthenticationService>(); |             services.AddScoped<IAuthenticationService, AuthenticationService>(); | ||||||
| @@ -1,14 +1,11 @@ | |||||||
| using Core.Blueprint.Storage.Adapters; | using Core.Thalos.BuildingBlocks; | ||||||
| using Core.Cerberos.Adapters; | using Core.Thalos.External.Clients.Requests; | ||||||
| using Core.Cerberos.Adapters.Common.Constants; |  | ||||||
| using Core.Cerberos.Adapters.Common.Enums; |  | ||||||
| using Core.Cerberos.External.Clients.Requests; |  | ||||||
| using Microsoft.AspNetCore.Mvc; | using Microsoft.AspNetCore.Mvc; | ||||||
| using Refit; | using Refit; | ||||||
| 
 | 
 | ||||||
| namespace Core.Cerberos.External.Clients | namespace Core.Thalos.External.Clients | ||||||
| { | { | ||||||
|     public interface ICerberosServiceClient |     public interface IThalosServiceClient | ||||||
|     { |     { | ||||||
|         [Get("/v1/User")] |         [Get("/v1/User")] | ||||||
|         Task<IEnumerable<UserAdapter>> GetAllUsersAsync(CancellationToken cancellationToken = default); |         Task<IEnumerable<UserAdapter>> GetAllUsersAsync(CancellationToken cancellationToken = default); | ||||||
| @@ -35,29 +32,11 @@ namespace Core.Cerberos.External.Clients | |||||||
|         Task<UserAdapter> LogoutUserAsync([FromRoute] string email, CancellationToken cancellationToken = default); |         Task<UserAdapter> LogoutUserAsync([FromRoute] string email, CancellationToken cancellationToken = default); | ||||||
| 
 | 
 | ||||||
|         [Patch("/v1/User/" + Routes.ChangeStatus)] |         [Patch("/v1/User/" + Routes.ChangeStatus)] | ||||||
|         Task<UserAdapter> ChangeUserStatusAsync([FromRoute] string id, StatusEnum newStatus, CancellationToken cancellationToken = default); |         Task<UserAdapter> ChangeUserStatusAsync([FromRoute] string id, Blueprint.Mongo.StatusEnum newStatus, CancellationToken cancellationToken = default); | ||||||
| 
 | 
 | ||||||
|         [Get("/v1/User/{email}/GetTokenAdapter")] |         [Get("/v1/User/{email}/GetTokenAdapter")] | ||||||
|         Task<TokenAdapter> GetTokenAdapter([FromRoute] string email, CancellationToken cancellationToken = default); |         Task<TokenAdapter> GetTokenAdapter([FromRoute] string email, CancellationToken cancellationToken = default); | ||||||
| 
 | 
 | ||||||
|         [Post("/v1/User/" + Routes.AddCompany)] |  | ||||||
|         Task<UserAdapter> AddCompanyToUserAsync([FromRoute] string userId, [FromRoute] string companyId, CancellationToken cancellationToken = default); |  | ||||||
| 
 |  | ||||||
|         [Delete("/v1/User/" + Routes.RemoveCompany)] |  | ||||||
|         Task<UserAdapter> RemoveCompanyToUserAsync([FromRoute] string userId, [FromRoute] string companyId, CancellationToken cancellationToken = default); |  | ||||||
| 
 |  | ||||||
|         [Post("/v1/User/" + Routes.AddProject)] |  | ||||||
|         Task<UserAdapter> AddProjectToUserAsync([FromRoute] string userId, [FromRoute] string projectId, CancellationToken cancellationToken = default); |  | ||||||
| 
 |  | ||||||
|         [Delete("/v1/User/" + Routes.RemoveProject)] |  | ||||||
|         Task<UserAdapter> RemoveProjectToUserAsync([FromRoute] string userId, [FromRoute] string projectId, CancellationToken cancellationToken = default); |  | ||||||
| 
 |  | ||||||
|         [Get("/v1/User/GetConsentFormPDF")] |  | ||||||
|         Task<BlobDownloadUriAdapter> GetConsentFormPDFAsync(CancellationToken cancellationToken = default); |  | ||||||
| 
 |  | ||||||
|         [Patch("/v1/User/AcceptUserConsentForm")] |  | ||||||
|         Task<UserAdapter> AcceptUserConsentFormAsync(CancellationToken cancellationToken = default); |  | ||||||
| 
 |  | ||||||
|         [Get("/v1/Role")] |         [Get("/v1/Role")] | ||||||
|         Task<IEnumerable<RoleAdapter>> GetAllRolesAsync(CancellationToken cancellationToken = default); |         Task<IEnumerable<RoleAdapter>> GetAllRolesAsync(CancellationToken cancellationToken = default); | ||||||
| 
 | 
 | ||||||
| @@ -71,7 +50,7 @@ namespace Core.Cerberos.External.Clients | |||||||
|         Task<RoleAdapter> UpdateRoleAsync([FromBody] RoleAdapter entity, [FromRoute] string id, CancellationToken cancellationToken = default); |         Task<RoleAdapter> UpdateRoleAsync([FromBody] RoleAdapter entity, [FromRoute] string id, CancellationToken cancellationToken = default); | ||||||
| 
 | 
 | ||||||
|         [Patch("/v1/Role/" + Routes.ChangeStatus)] |         [Patch("/v1/Role/" + Routes.ChangeStatus)] | ||||||
|         Task<RoleAdapter> ChangeRoleStatusAsync([FromRoute] string id, [FromRoute] StatusEnum newStatus, CancellationToken cancellationToken = default); |         Task<RoleAdapter> ChangeRoleStatusAsync([FromRoute] string id, [FromRoute] Blueprint.Mongo.StatusEnum newStatus, CancellationToken cancellationToken = default); | ||||||
| 
 | 
 | ||||||
|         [Post("/v1/Role/" + Routes.AddApplication)] |         [Post("/v1/Role/" + Routes.AddApplication)] | ||||||
|         Task<RoleAdapter> AddApplicationToRoleAsync([FromRoute] string RoleId, [FromRoute] ApplicationsEnum application, CancellationToken cancellationToken = default); |         Task<RoleAdapter> AddApplicationToRoleAsync([FromRoute] string RoleId, [FromRoute] ApplicationsEnum application, CancellationToken cancellationToken = default); | ||||||
| @@ -95,7 +74,7 @@ namespace Core.Cerberos.External.Clients | |||||||
|         Task<PermissionAdapter> UpdatePermissionAsync([FromBody] PermissionAdapter entity, [FromRoute] string id, CancellationToken cancellationToken = default); |         Task<PermissionAdapter> UpdatePermissionAsync([FromBody] PermissionAdapter entity, [FromRoute] string id, CancellationToken cancellationToken = default); | ||||||
| 
 | 
 | ||||||
|         [Patch("/v1/Permission/" + Routes.ChangeStatus)] |         [Patch("/v1/Permission/" + Routes.ChangeStatus)] | ||||||
|         Task<PermissionAdapter> ChangeStatusPermissionAsync([FromRoute] string id, [FromRoute] StatusEnum newStatus, CancellationToken cancellationToken = default); |         Task<PermissionAdapter> ChangeStatusPermissionAsync([FromRoute] string id, [FromRoute] Blueprint.Mongo.StatusEnum newStatus, CancellationToken cancellationToken = default); | ||||||
| 
 | 
 | ||||||
|         [Get("/v1/Module")] |         [Get("/v1/Module")] | ||||||
|         Task<IEnumerable<ModuleAdapter>> GetAllModulesAsync(CancellationToken cancellationToken = default); |         Task<IEnumerable<ModuleAdapter>> GetAllModulesAsync(CancellationToken cancellationToken = default); | ||||||
| @@ -113,6 +92,6 @@ namespace Core.Cerberos.External.Clients | |||||||
|         Task<ModuleAdapter> UpdateModuleAsync([FromBody] ModuleAdapter entity, [FromRoute] string id, CancellationToken cancellationToken = default); |         Task<ModuleAdapter> UpdateModuleAsync([FromBody] ModuleAdapter entity, [FromRoute] string id, CancellationToken cancellationToken = default); | ||||||
| 
 | 
 | ||||||
|         [Patch("/v1/Module/" + Routes.ChangeStatus)] |         [Patch("/v1/Module/" + Routes.ChangeStatus)] | ||||||
|         Task<ModuleAdapter> ChangeStatusModuleAsync([FromRoute] string id, [FromRoute] StatusEnum newStatus, CancellationToken cancellationToken = default); |         Task<ModuleAdapter> ChangeStatusModuleAsync([FromRoute] string id, [FromRoute] Blueprint.Mongo.StatusEnum newStatus, CancellationToken cancellationToken = default); | ||||||
|     } |     } | ||||||
| } | } | ||||||
| @@ -1,7 +1,7 @@ | |||||||
| using Core.Cerberos.Adapters.Common.Enums; | using Core.Thalos.BuildingBlocks; | ||||||
| using System.Text.Json.Serialization; | using System.Text.Json.Serialization; | ||||||
| 
 | 
 | ||||||
| namespace Core.Cerberos.External.Clients.Requests | namespace Core.Thalos.External.Clients.Requests | ||||||
| { | { | ||||||
|     public class ModuleRequest |     public class ModuleRequest | ||||||
|     { |     { | ||||||
| @@ -1,6 +1,6 @@ | |||||||
| using Core.Cerberos.Adapters.Common.Constants; | using Core.Thalos.BuildingBlocks; | ||||||
| 
 | 
 | ||||||
| namespace Core.Cerberos.External.Clients.Requests | namespace Core.Thalos.External.Clients.Requests | ||||||
| { | { | ||||||
|     public class PermissionRequest |     public class PermissionRequest | ||||||
|     { |     { | ||||||
| @@ -1,7 +1,7 @@ | |||||||
| using Core.Cerberos.Adapters.Common.Enums; | using Core.Thalos.BuildingBlocks; | ||||||
| using System.Text.Json.Serialization; | using System.Text.Json.Serialization; | ||||||
| 
 | 
 | ||||||
| namespace Core.Cerberos.External.Clients.Requests | namespace Core.Thalos.External.Clients.Requests | ||||||
| { | { | ||||||
|     public class RoleRequest |     public class RoleRequest | ||||||
|     { |     { | ||||||
| @@ -1,4 +1,4 @@ | |||||||
| namespace Core.Cerberos.External.Clients.Requests | namespace Core.Thalos.External.Clients.Requests | ||||||
| { | { | ||||||
|     public class UserRequest |     public class UserRequest | ||||||
|     { |     { | ||||||
| @@ -7,7 +7,5 @@ | |||||||
|         public string? MiddleName { get; set; } |         public string? MiddleName { get; set; } | ||||||
|         public string LastName { get; set; } = null!; |         public string LastName { get; set; } = null!; | ||||||
|         public string RoleId { get; set; } = null!; |         public string RoleId { get; set; } = null!; | ||||||
|         public string[] Companies { get; set; } = null!; |  | ||||||
|         public string[]? Projects { get; set; } |  | ||||||
|     } |     } | ||||||
| } | } | ||||||
| @@ -7,9 +7,9 @@ | |||||||
|   </PropertyGroup> |   </PropertyGroup> | ||||||
| 
 | 
 | ||||||
|   <ItemGroup> |   <ItemGroup> | ||||||
|     <PackageReference Include="Core.Blueprint.Storage" Version="0.3.0-alpha0049" /> |     <PackageReference Include="Core.Blueprint.Storage" Version="1.0.1" /> | ||||||
|     <PackageReference Include="Core.Cerberos.Adapters" Version="0.3.0-alpha0042" /> |     <PackageReference Include="Core.Thalos.BuildingBlocks" Version="1.0.8" /> | ||||||
|     <PackageReference Include="Lib.Architecture.BuildingBlocks" Version="0.9.0-alpha0001" /> |     <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> | ||||||
| 
 | 
 | ||||||
| @@ -1,17 +1,17 @@ | |||||||
| using Core.Blueprint.External; | using Core.Blueprint.External; | ||||||
| 
 | 
 | ||||||
| namespace Core.Cerberos.External.GatewayConfigurations | namespace Core.Thalos.External.GatewayConfigurations | ||||||
| { | { | ||||||
|     public record GatewayConfiguration |     public record GatewayConfiguration | ||||||
|     { |     { | ||||||
|         public GatewayConfiguration() |         public GatewayConfiguration() | ||||||
|         { |         { | ||||||
|             CerberosService = new CerberosServiceAPI(); |             ThalosService = new ThalosServiceAPI(); | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         public CerberosServiceAPI CerberosService { get; set; } |         public ThalosServiceAPI ThalosService { get; set; } | ||||||
|     } |     } | ||||||
|     public record CerberosServiceAPI |     public record ThalosServiceAPI | ||||||
|     { |     { | ||||||
|         public string Channel { get; set; } |         public string Channel { get; set; } | ||||||
|         public BaseEndpoint Endpoint { get; set; } |         public BaseEndpoint Endpoint { get; set; } | ||||||
| @@ -1,7 +1,7 @@ | |||||||
| using Core.Blueprint.External; | using Core.Blueprint.External; | ||||||
| using Microsoft.Extensions.Configuration; | using Microsoft.Extensions.Configuration; | ||||||
| 
 | 
 | ||||||
| namespace Core.Cerberos.External.GatewayConfigurations | namespace Core.Thalos.External.GatewayConfigurations | ||||||
| { | { | ||||||
|     public class GatewaySettingsConfigurations |     public class GatewaySettingsConfigurations | ||||||
|     { |     { | ||||||
| @@ -11,13 +11,13 @@ namespace Core.Cerberos.External.GatewayConfigurations | |||||||
|         public GatewaySettingsConfigurations(IConfiguration configuration) |         public GatewaySettingsConfigurations(IConfiguration configuration) | ||||||
|         { |         { | ||||||
|             _configuration = configuration; |             _configuration = configuration; | ||||||
|             this.SetCerberosServiceAPIEndpoint(); |             this.SetThalosServiceAPIEndpoint(); | ||||||
|         } |         } | ||||||
|         public static CerberosServiceAPI GetCerberosServiceAPIEndpoint() |         public static ThalosServiceAPI GetThalosServiceAPIEndpoint() | ||||||
|         { |         { | ||||||
|             return GatewayConfigurations.CerberosService; |             return GatewayConfigurations.ThalosService; | ||||||
|         } |         } | ||||||
|         private GatewayConfiguration SetCerberosServiceAPIEndpoint() |         private GatewayConfiguration SetThalosServiceAPIEndpoint() | ||||||
|         { |         { | ||||||
|             IConfigurationSection source; |             IConfigurationSection source; | ||||||
|             var environment = Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT") ?? string.Empty; |             var environment = Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT") ?? string.Empty; | ||||||
| @@ -27,18 +27,18 @@ namespace Core.Cerberos.External.GatewayConfigurations | |||||||
|             else |             else | ||||||
|                 source = _configuration.GetSection("Gateways"); |                 source = _configuration.GetSection("Gateways"); | ||||||
| 
 | 
 | ||||||
|             var endpoint = source["CerberosDAL"] ?? string.Empty; |             var endpoint = source["ThalosDAL"] ?? string.Empty; | ||||||
| 
 | 
 | ||||||
|             if (string.IsNullOrEmpty(endpoint)) throw new Exception("Cerberos DAL endpoint is empty or null"); |             if (string.IsNullOrEmpty(endpoint)) throw new Exception("Thalos DAL endpoint is empty or null"); | ||||||
| 
 | 
 | ||||||
|             GatewayConfigurations.CerberosService = new CerberosServiceAPI() |             GatewayConfigurations.ThalosService = new ThalosServiceAPI() | ||||||
|             { |             { | ||||||
|                 Endpoint = new BaseEndpoint() |                 Endpoint = new BaseEndpoint() | ||||||
|                 { |                 { | ||||||
|                     Uri = new Uri(endpoint), |                     Uri = new Uri(endpoint), | ||||||
|                     Url = endpoint, |                     Url = endpoint, | ||||||
|                     Token = string.Empty, |                     Token = string.Empty, | ||||||
|                     APIName = "Cerberos Service" |                     APIName = "Thalos Service" | ||||||
|                 } |                 } | ||||||
|             }; |             }; | ||||||
| 
 | 
 | ||||||
| @@ -1,10 +1,10 @@ | |||||||
| // *********************************************************************** | // *********************************************************************** | ||||||
| // <copyright file="AuthenticatedHttpClientHandler.cs"> | // <copyright file="AuthenticatedHttpClientHandler.cs"> | ||||||
| //     Heath | //     AgileWebs | ||||||
| // </copyright> | // </copyright> | ||||||
| // *********************************************************************** | // *********************************************************************** | ||||||
| 
 | 
 | ||||||
| namespace Core.Cerberos.External.Helpers.Token | namespace Core.Thalos.External.Helpers.Token | ||||||
| { | { | ||||||
|     /// <summary> |     /// <summary> | ||||||
|     /// Class to inject the token in all requests. |     /// Class to inject the token in all requests. | ||||||
| @@ -1,12 +1,12 @@ | |||||||
| // *********************************************************************** | // *********************************************************************** | ||||||
| // <copyright file="HttpContextTokenProvider.cs"> | // <copyright file="HttpContextTokenProvider.cs"> | ||||||
| //     Heath | //     AgileWebs | ||||||
| // </copyright> | // </copyright> | ||||||
| // *********************************************************************** | // *********************************************************************** | ||||||
| 
 | 
 | ||||||
| using Microsoft.AspNetCore.Http; | using Microsoft.AspNetCore.Http; | ||||||
| 
 | 
 | ||||||
| namespace Core.Cerberos.External.Helpers.Token | namespace Core.Thalos.External.Helpers.Token | ||||||
| { | { | ||||||
|     /// <summary> |     /// <summary> | ||||||
|     /// Class to return the access token to controllers. |     /// Class to return the access token to controllers. | ||||||
| @@ -1,10 +1,10 @@ | |||||||
| // *********************************************************************** | // *********************************************************************** | ||||||
| // <copyright file="ITokenProvider.cs"> | // <copyright file="ITokenProvider.cs"> | ||||||
| //     Heath | //     AgileWebs | ||||||
| // </copyright> | // </copyright> | ||||||
| // *********************************************************************** | // *********************************************************************** | ||||||
| 
 | 
 | ||||||
| namespace Core.Cerberos.External.Helpers.Token | namespace Core.Thalos.External.Helpers.Token | ||||||
| { | { | ||||||
|     /// <summary> |     /// <summary> | ||||||
|     /// Interface for token provider. |     /// Interface for token provider. | ||||||
| @@ -3,15 +3,15 @@ Microsoft Visual Studio Solution File, Format Version 12.00 | |||||||
| # Visual Studio Version 17 | # Visual Studio Version 17 | ||||||
| VisualStudioVersion = 17.10.34928.147 | VisualStudioVersion = 17.10.34928.147 | ||||||
| MinimumVisualStudioVersion = 10.0.40219.1 | MinimumVisualStudioVersion = 10.0.40219.1 | ||||||
| Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Core.Cerberos.Service.API", "Core.Cerberos.Service.API\Core.Cerberos.Service.API.csproj", "{00F5B578-77EE-44A9-A611-5D753FDF158D}" | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Core.Thalos.Service.API", "Core.Thalos.Service.API\Core.Thalos.Service.API.csproj", "{00F5B578-77EE-44A9-A611-5D753FDF158D}" | ||||||
| EndProject | EndProject | ||||||
| Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Application", "Application", "{F33D7786-EFE5-4618-9D47-C0272227C095}" | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Application", "Application", "{F33D7786-EFE5-4618-9D47-C0272227C095}" | ||||||
| EndProject | EndProject | ||||||
| Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Presentation", "Presentation", "{685F19C0-CE60-4BFB-9EDB-6834D01A6161}" | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Presentation", "Presentation", "{685F19C0-CE60-4BFB-9EDB-6834D01A6161}" | ||||||
| EndProject | EndProject | ||||||
| Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Core.Cerberos.External", "Core.Cerberos.External\Core.Cerberos.External.csproj", "{52EB3BBE-DACB-4EE5-8FFA-B8DBE34BA137}" | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Core.Thalos.External", "Core.Thalos.External\Core.Thalos.External.csproj", "{52EB3BBE-DACB-4EE5-8FFA-B8DBE34BA137}" | ||||||
| EndProject | EndProject | ||||||
| Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Core.Cerberos.Application", "Core.Cerberos.Application\Core.Cerberos.Application.csproj", "{F1980B4D-35C3-4495-84CF-09E1D3822CDA}" | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Core.Thalos.Application", "Core.Thalos.Application\Core.Thalos.Application.csproj", "{F1980B4D-35C3-4495-84CF-09E1D3822CDA}" | ||||||
| EndProject | EndProject | ||||||
| Global | Global | ||||||
| 	GlobalSection(SolutionConfigurationPlatforms) = preSolution | 	GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||||||
| @@ -1,14 +1,12 @@ | |||||||
| using Asp.Versioning; | using Asp.Versioning; | ||||||
| using Core.Cerberos.Adapters; | using Core.Thalos.Application.UseCases.Modules.Input; | ||||||
| using Core.Cerberos.Adapters.Attributes; | using Core.Thalos.Application.UseCases.Modules.Ports; | ||||||
| using Core.Cerberos.Adapters.Common.Constants; | using Core.Thalos.BuildingBlocks; | ||||||
| using Core.Cerberos.Application.UseCases.Modules.Input; |  | ||||||
| using Core.Cerberos.Application.UseCases.Modules.Ports; |  | ||||||
| using Lib.Architecture.BuildingBlocks; | using Lib.Architecture.BuildingBlocks; | ||||||
| using Microsoft.AspNetCore.Authorization; | using Microsoft.AspNetCore.Authorization; | ||||||
| using Microsoft.AspNetCore.Mvc; | using Microsoft.AspNetCore.Mvc; | ||||||
| 
 | 
 | ||||||
| namespace Core.Cerberos.Service.API.Controllers | namespace Core.Thalos.Service.API.Controllers | ||||||
| { | { | ||||||
|     /// <summary> |     /// <summary> | ||||||
|     /// Handles all services and business rules related to <see cref="ModuleController"/>. |     /// Handles all services and business rules related to <see cref="ModuleController"/>. | ||||||
| @@ -17,6 +15,7 @@ namespace Core.Cerberos.Service.API.Controllers | |||||||
|     [Route("api/v{api-version:apiVersion}/[controller]")]
 |     [Route("api/v{api-version:apiVersion}/[controller]")]
 | ||||||
|     [Produces("application/json")] |     [Produces("application/json")] | ||||||
|     [ApiController] |     [ApiController] | ||||||
|  |     [Authorize(AuthenticationSchemes = Schemes.DefaultScheme)] | ||||||
|     public class ModuleController : ControllerBase |     public class ModuleController : ControllerBase | ||||||
|     { |     { | ||||||
|         private readonly IComponentHandler<GetModuleRequest> getModuleHandler; |         private readonly IComponentHandler<GetModuleRequest> getModuleHandler; | ||||||
| @@ -60,7 +59,6 @@ namespace Core.Cerberos.Service.API.Controllers | |||||||
|         [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] |         [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] | ||||||
|         [ProducesResponseType(StatusCodes.Status500InternalServerError)] |         [ProducesResponseType(StatusCodes.Status500InternalServerError)] | ||||||
|         [ProducesResponseType(StatusCodes.Status400BadRequest)] |         [ProducesResponseType(StatusCodes.Status400BadRequest)] | ||||||
|         [Authorize(AuthenticationSchemes = Schemes.HeathScheme)] |  | ||||||
|         [Permission("ModuleManagement.Read, RoleManagement.Read")] |         [Permission("ModuleManagement.Read, RoleManagement.Read")] | ||||||
|         public async Task<IActionResult> GetAllModulesAsync(CancellationToken cancellationToken) |         public async Task<IActionResult> GetAllModulesAsync(CancellationToken cancellationToken) | ||||||
|         { |         { | ||||||
| @@ -91,7 +89,6 @@ namespace Core.Cerberos.Service.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.HeathScheme)] |  | ||||||
|         [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) | ||||||
|         { |         { | ||||||
| @@ -118,7 +115,6 @@ namespace Core.Cerberos.Service.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.HeathScheme)] |  | ||||||
|         [Permission("ModuleManagement.Read")] |         [Permission("ModuleManagement.Read")] | ||||||
|         public async Task<IActionResult> GetModuleById([FromBody] GetModuleRequest request, CancellationToken cancellationToken) |         public async Task<IActionResult> GetModuleById([FromBody] GetModuleRequest request, CancellationToken cancellationToken) | ||||||
|         { |         { | ||||||
| @@ -144,7 +140,6 @@ namespace Core.Cerberos.Service.API.Controllers | |||||||
|         [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] |         [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] | ||||||
|         [ProducesResponseType(StatusCodes.Status500InternalServerError)] |         [ProducesResponseType(StatusCodes.Status500InternalServerError)] | ||||||
|         [ProducesResponseType(StatusCodes.Status400BadRequest)] |         [ProducesResponseType(StatusCodes.Status400BadRequest)] | ||||||
|         [Authorize(AuthenticationSchemes = Schemes.HeathScheme)] |  | ||||||
|         [Permission("ModuleManagement.Write")] |         [Permission("ModuleManagement.Write")] | ||||||
|         public async Task<IActionResult> CreateModuleAsync([FromBody] CreateModuleRequest newModule, CancellationToken cancellationToken = default) |         public async Task<IActionResult> CreateModuleAsync([FromBody] CreateModuleRequest newModule, CancellationToken cancellationToken = default) | ||||||
|         { |         { | ||||||
| @@ -164,7 +159,6 @@ namespace Core.Cerberos.Service.API.Controllers | |||||||
|         [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] |         [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] | ||||||
|         [ProducesResponseType(StatusCodes.Status500InternalServerError)] |         [ProducesResponseType(StatusCodes.Status500InternalServerError)] | ||||||
|         [ProducesResponseType(StatusCodes.Status400BadRequest)] |         [ProducesResponseType(StatusCodes.Status400BadRequest)] | ||||||
|         [Authorize(AuthenticationSchemes = Schemes.HeathScheme)] |  | ||||||
|         [Permission("ModuleManagement.Write")] |         [Permission("ModuleManagement.Write")] | ||||||
|         public async Task<IActionResult> UpdateModuleAsync([FromBody] UpdateModuleRequest request, CancellationToken cancellationToken = default) |         public async Task<IActionResult> UpdateModuleAsync([FromBody] UpdateModuleRequest request, CancellationToken cancellationToken = default) | ||||||
|         { |         { | ||||||
| @@ -185,7 +179,6 @@ namespace Core.Cerberos.Service.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.HeathScheme)] |  | ||||||
|         [Permission("ModuleManagement.Write")] |         [Permission("ModuleManagement.Write")] | ||||||
|         public async Task<IActionResult> ChangeModuleStatusAsync([FromBody] ChangeModuleStatusRequest request, |         public async Task<IActionResult> ChangeModuleStatusAsync([FromBody] ChangeModuleStatusRequest request, | ||||||
|                                                                      CancellationToken cancellationToken) |                                                                      CancellationToken cancellationToken) | ||||||
| @@ -1,14 +1,12 @@ | |||||||
| using Asp.Versioning; | using Asp.Versioning; | ||||||
| using Core.Cerberos.Adapters; | using Core.Thalos.Application.UseCases.Permissions.Input; | ||||||
| using Core.Cerberos.Adapters.Attributes; | using Core.Thalos.Application.UseCases.Permissions.Ports; | ||||||
| using Core.Cerberos.Adapters.Common.Constants; | using Core.Thalos.BuildingBlocks; | ||||||
| using Core.Cerberos.Application.UseCases.Permissions.Input; |  | ||||||
| using Core.Cerberos.Application.UseCases.Permissions.Ports; |  | ||||||
| using Lib.Architecture.BuildingBlocks; | using Lib.Architecture.BuildingBlocks; | ||||||
| using Microsoft.AspNetCore.Authorization; | using Microsoft.AspNetCore.Authorization; | ||||||
| using Microsoft.AspNetCore.Mvc; | using Microsoft.AspNetCore.Mvc; | ||||||
| 
 | 
 | ||||||
| namespace Core.Cerberos.Service.API.Controllers | namespace Core.Thalos.Service.API.Controllers | ||||||
| { | { | ||||||
|     /// <summary> |     /// <summary> | ||||||
|     /// Handles all services and business rules related to <see cref="PermissionController"/>. |     /// Handles all services and business rules related to <see cref="PermissionController"/>. | ||||||
| @@ -17,6 +15,7 @@ namespace Core.Cerberos.Service.API.Controllers | |||||||
|     [Route("api/v{api-version:apiVersion}/[controller]")]
 |     [Route("api/v{api-version:apiVersion}/[controller]")]
 | ||||||
|     [Produces("application/json")] |     [Produces("application/json")] | ||||||
|     [ApiController] |     [ApiController] | ||||||
|  |     [Authorize(AuthenticationSchemes = Schemes.DefaultScheme)] | ||||||
|     public class PermissionController : ControllerBase |     public class PermissionController : ControllerBase | ||||||
|     { |     { | ||||||
|         private readonly IComponentHandler<GetPermissionRequest> getPermissionHandler; |         private readonly IComponentHandler<GetPermissionRequest> getPermissionHandler; | ||||||
| @@ -60,7 +59,6 @@ namespace Core.Cerberos.Service.API.Controllers | |||||||
|         [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] |         [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] | ||||||
|         [ProducesResponseType(StatusCodes.Status500InternalServerError)] |         [ProducesResponseType(StatusCodes.Status500InternalServerError)] | ||||||
|         [ProducesResponseType(StatusCodes.Status400BadRequest)] |         [ProducesResponseType(StatusCodes.Status400BadRequest)] | ||||||
|         [Authorize(AuthenticationSchemes = Schemes.HeathScheme)] |  | ||||||
|         [Permission("PermissionManagement.Read, RoleManagement.Read")] |         [Permission("PermissionManagement.Read, RoleManagement.Read")] | ||||||
|         public async Task<IActionResult> GetAllPermissionsAsync(CancellationToken cancellationToken) |         public async Task<IActionResult> GetAllPermissionsAsync(CancellationToken cancellationToken) | ||||||
|         { |         { | ||||||
| @@ -91,7 +89,6 @@ namespace Core.Cerberos.Service.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.HeathScheme)] |  | ||||||
|         [Permission("PermissionManagement.Read")] |         [Permission("PermissionManagement.Read")] | ||||||
|         public async Task<IActionResult> GetAllPermissionsByListAsync([FromBody] GetAllPermissionsByListRequest request, CancellationToken cancellationToken) |         public async Task<IActionResult> GetAllPermissionsByListAsync([FromBody] GetAllPermissionsByListRequest request, CancellationToken cancellationToken) | ||||||
|         { |         { | ||||||
| @@ -118,7 +115,6 @@ namespace Core.Cerberos.Service.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.HeathScheme)] |  | ||||||
|         [Permission("PermissionManagement.Read")] |         [Permission("PermissionManagement.Read")] | ||||||
|         public async Task<IActionResult> GetPermissionById([FromBody] GetPermissionRequest request, CancellationToken cancellationToken) |         public async Task<IActionResult> GetPermissionById([FromBody] GetPermissionRequest request, CancellationToken cancellationToken) | ||||||
|         { |         { | ||||||
| @@ -144,7 +140,6 @@ namespace Core.Cerberos.Service.API.Controllers | |||||||
|         [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] |         [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] | ||||||
|         [ProducesResponseType(StatusCodes.Status500InternalServerError)] |         [ProducesResponseType(StatusCodes.Status500InternalServerError)] | ||||||
|         [ProducesResponseType(StatusCodes.Status400BadRequest)] |         [ProducesResponseType(StatusCodes.Status400BadRequest)] | ||||||
|         [Authorize(AuthenticationSchemes = Schemes.HeathScheme)] |  | ||||||
|         [Permission("PermissionManagement.Write")] |         [Permission("PermissionManagement.Write")] | ||||||
|         public async Task<IActionResult> CreatePermissionAsync([FromBody] CreatePermissionRequest newPermission, CancellationToken cancellationToken = default) |         public async Task<IActionResult> CreatePermissionAsync([FromBody] CreatePermissionRequest newPermission, CancellationToken cancellationToken = default) | ||||||
|         { |         { | ||||||
| @@ -164,7 +159,6 @@ namespace Core.Cerberos.Service.API.Controllers | |||||||
|         [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] |         [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] | ||||||
|         [ProducesResponseType(StatusCodes.Status500InternalServerError)] |         [ProducesResponseType(StatusCodes.Status500InternalServerError)] | ||||||
|         [ProducesResponseType(StatusCodes.Status400BadRequest)] |         [ProducesResponseType(StatusCodes.Status400BadRequest)] | ||||||
|         [Authorize(AuthenticationSchemes = Schemes.HeathScheme)] |  | ||||||
|         [Permission("PermissionManagement.Write")] |         [Permission("PermissionManagement.Write")] | ||||||
|         public async Task<IActionResult> UpdatePermissionAsync([FromBody] UpdatePermissionRequest request, CancellationToken cancellationToken = default) |         public async Task<IActionResult> UpdatePermissionAsync([FromBody] UpdatePermissionRequest request, CancellationToken cancellationToken = default) | ||||||
|         { |         { | ||||||
| @@ -185,7 +179,6 @@ namespace Core.Cerberos.Service.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.HeathScheme)] |  | ||||||
|         [Permission("PermissionManagement.Write")] |         [Permission("PermissionManagement.Write")] | ||||||
|         public async Task<IActionResult> ChangePermissionStatusAsync([FromBody] ChangePermissionStatusRequest request, |         public async Task<IActionResult> ChangePermissionStatusAsync([FromBody] ChangePermissionStatusRequest request, | ||||||
|                                                                      CancellationToken cancellationToken) |                                                                      CancellationToken cancellationToken) | ||||||
| @@ -1,13 +1,12 @@ | |||||||
| using Asp.Versioning; | using Asp.Versioning; | ||||||
| using Core.Cerberos.Adapters.Attributes; | using Core.Thalos.Application.UseCases.Roles.Input; | ||||||
| using Core.Cerberos.Adapters.Common.Constants; | using Core.Thalos.Application.UseCases.Roles.Ports; | ||||||
| using Core.Cerberos.Application.UseCases.Roles.Input; | using Core.Thalos.BuildingBlocks; | ||||||
| using Core.Cerberos.Application.UseCases.Roles.Ports; |  | ||||||
| using Lib.Architecture.BuildingBlocks; | using Lib.Architecture.BuildingBlocks; | ||||||
| using Microsoft.AspNetCore.Authorization; | using Microsoft.AspNetCore.Authorization; | ||||||
| using Microsoft.AspNetCore.Mvc; | using Microsoft.AspNetCore.Mvc; | ||||||
| 
 | 
 | ||||||
| namespace Core.Cerberos.Service.API.Controllers | namespace Core.Thalos.Service.API.Controllers | ||||||
| { | { | ||||||
|     /// <summary> |     /// <summary> | ||||||
|     /// Handles all requests for role authentication. |     /// Handles all requests for role authentication. | ||||||
| @@ -16,7 +15,7 @@ namespace Core.Cerberos.Service.API.Controllers | |||||||
|     [Route("api/v{api-version:apiVersion}/[controller]")]
 |     [Route("api/v{api-version:apiVersion}/[controller]")]
 | ||||||
|     [Produces("application/json")] |     [Produces("application/json")] | ||||||
|     [ApiController] |     [ApiController] | ||||||
|     [Authorize(AuthenticationSchemes = Schemes.HeathScheme)] |     [Authorize(AuthenticationSchemes = Schemes.DefaultScheme)] | ||||||
|     public class RoleController : ControllerBase |     public class RoleController : ControllerBase | ||||||
|     { |     { | ||||||
|         private readonly IComponentHandler<GetRoleRequest> getRoleHandler; |         private readonly IComponentHandler<GetRoleRequest> getRoleHandler; | ||||||
| @@ -63,7 +62,6 @@ namespace Core.Cerberos.Service.API.Controllers | |||||||
|         [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] |         [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] | ||||||
|         [ProducesResponseType(StatusCodes.Status500InternalServerError)] |         [ProducesResponseType(StatusCodes.Status500InternalServerError)] | ||||||
|         [ProducesResponseType(StatusCodes.Status400BadRequest)] |         [ProducesResponseType(StatusCodes.Status400BadRequest)] | ||||||
|         [Authorize(AuthenticationSchemes = Schemes.HeathScheme)] |  | ||||||
|         [Permission("RoleManagement.Read")] |         [Permission("RoleManagement.Read")] | ||||||
|         public async Task<IActionResult> GetAllRolesAsync(CancellationToken cancellationToken) |         public async Task<IActionResult> GetAllRolesAsync(CancellationToken cancellationToken) | ||||||
|         { |         { | ||||||
| @@ -84,7 +82,6 @@ namespace Core.Cerberos.Service.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.HeathScheme)] |  | ||||||
|         [Permission("RoleManagement.Read")] |         [Permission("RoleManagement.Read")] | ||||||
|         public async Task<IActionResult> GetRoleById([FromBody] GetRoleRequest request, CancellationToken cancellationToken) |         public async Task<IActionResult> GetRoleById([FromBody] GetRoleRequest request, CancellationToken cancellationToken) | ||||||
|         { |         { | ||||||
| @@ -106,7 +103,6 @@ namespace Core.Cerberos.Service.API.Controllers | |||||||
|         [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] |         [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] | ||||||
|         [ProducesResponseType(StatusCodes.Status500InternalServerError)] |         [ProducesResponseType(StatusCodes.Status500InternalServerError)] | ||||||
|         [ProducesResponseType(StatusCodes.Status400BadRequest)] |         [ProducesResponseType(StatusCodes.Status400BadRequest)] | ||||||
|         [Authorize(AuthenticationSchemes = Schemes.HeathScheme)] |  | ||||||
|         [Permission("RoleManagement.Write")] |         [Permission("RoleManagement.Write")] | ||||||
|         public async Task<IActionResult> CreateRoleAsync([FromBody] CreateRoleRequest newRole, CancellationToken cancellationToken = default) |         public async Task<IActionResult> CreateRoleAsync([FromBody] CreateRoleRequest newRole, CancellationToken cancellationToken = default) | ||||||
|         { |         { | ||||||
| @@ -126,7 +122,6 @@ namespace Core.Cerberos.Service.API.Controllers | |||||||
|         [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] |         [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] | ||||||
|         [ProducesResponseType(StatusCodes.Status500InternalServerError)] |         [ProducesResponseType(StatusCodes.Status500InternalServerError)] | ||||||
|         [ProducesResponseType(StatusCodes.Status400BadRequest)] |         [ProducesResponseType(StatusCodes.Status400BadRequest)] | ||||||
|         [Authorize(AuthenticationSchemes = Schemes.HeathScheme)] |  | ||||||
|         [Permission("RoleManagement.Write")] |         [Permission("RoleManagement.Write")] | ||||||
|         public async Task<IActionResult> UpdateRoleAsync([FromBody] UpdateRoleRequest entity, CancellationToken cancellationToken = default) |         public async Task<IActionResult> UpdateRoleAsync([FromBody] UpdateRoleRequest entity, CancellationToken cancellationToken = default) | ||||||
|         { |         { | ||||||
| @@ -147,7 +142,6 @@ namespace Core.Cerberos.Service.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.HeathScheme)] |  | ||||||
|         [Permission("RoleManagement.Write")] |         [Permission("RoleManagement.Write")] | ||||||
|         public async Task<IActionResult> ChageRoleStatusAsync(ChangeRoleStatusRequest request, CancellationToken cancellationToken) |         public async Task<IActionResult> ChageRoleStatusAsync(ChangeRoleStatusRequest request, CancellationToken cancellationToken) | ||||||
|         { |         { | ||||||
| @@ -170,7 +164,6 @@ namespace Core.Cerberos.Service.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.HeathScheme)] |  | ||||||
|         [Permission("RoleManagement.Write")] |         [Permission("RoleManagement.Write")] | ||||||
|         public async Task<IActionResult> AddApplicationToRoleAsync(AddApplicationToRoleRequest request, CancellationToken cancellationToken) |         public async Task<IActionResult> AddApplicationToRoleAsync(AddApplicationToRoleRequest request, CancellationToken cancellationToken) | ||||||
|         { |         { | ||||||
| @@ -193,7 +186,6 @@ namespace Core.Cerberos.Service.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.HeathScheme)] |  | ||||||
|         [Permission("RoleManagement.Write")] |         [Permission("RoleManagement.Write")] | ||||||
|         public async Task<IActionResult> RemoveApplicationToRoleAsync(RemoveApplicationFromRoleRequest request, |         public async Task<IActionResult> RemoveApplicationToRoleAsync(RemoveApplicationFromRoleRequest request, | ||||||
|                                                                    CancellationToken cancellationToken) |                                                                    CancellationToken cancellationToken) | ||||||
| @@ -1,14 +1,12 @@ | |||||||
| using Asp.Versioning; | using Asp.Versioning; | ||||||
| using Core.Cerberos.Adapters; | using Core.Thalos.Application.UseCases.Users.Input; | ||||||
| using Core.Cerberos.Adapters.Attributes; | using Core.Thalos.Application.UseCases.Users.Ports; | ||||||
| using Core.Cerberos.Adapters.Common.Constants; | using Core.Thalos.BuildingBlocks; | ||||||
| using Core.Cerberos.Application.UseCases.Users.Input; |  | ||||||
| using Core.Cerberos.Application.UseCases.Users.Ports; |  | ||||||
| using Lib.Architecture.BuildingBlocks; | using Lib.Architecture.BuildingBlocks; | ||||||
| using Microsoft.AspNetCore.Authorization; | using Microsoft.AspNetCore.Authorization; | ||||||
| using Microsoft.AspNetCore.Mvc; | using Microsoft.AspNetCore.Mvc; | ||||||
| 
 | 
 | ||||||
| namespace Core.Cerberos.Service.API.Controllers | namespace Core.Thalos.Service.API.Controllers | ||||||
| { | { | ||||||
|     /// <summary> |     /// <summary> | ||||||
|     /// Handles all requests for user. |     /// Handles all requests for user. | ||||||
| @@ -25,16 +23,10 @@ namespace Core.Cerberos.Service.API.Controllers | |||||||
|         private readonly IComponentHandler<CreateUserRequest> createUserHandler; |         private readonly IComponentHandler<CreateUserRequest> createUserHandler; | ||||||
|         private readonly IComponentHandler<UpdateUserRequest> updateUserHandler; |         private readonly IComponentHandler<UpdateUserRequest> updateUserHandler; | ||||||
|         private readonly IComponentHandler<ChangeUserStatusRequest> ChangeUserStatusHandler; |         private readonly IComponentHandler<ChangeUserStatusRequest> ChangeUserStatusHandler; | ||||||
|         private readonly IComponentHandler<AddCompanyToUserRequest> addCompanyToUserHandler; |  | ||||||
|         private readonly IComponentHandler<RemoveCompanyFromUserRequest> removeCompanyFromUserHandler; |  | ||||||
|         private readonly IComponentHandler<AddProjectToUserRequest> addProjectToUserHandler; |  | ||||||
|         private readonly IComponentHandler<RemoveProjectFromUserRequest> removeProjectFromUserHandler; |  | ||||||
|         private readonly IComponentHandler<LoginUserRequest> loginUserHandler; |         private readonly IComponentHandler<LoginUserRequest> loginUserHandler; | ||||||
|         private readonly IComponentHandler<LogoutUserRequest> logoutUserHandler; |         private readonly IComponentHandler<LogoutUserRequest> logoutUserHandler; | ||||||
|         private readonly IComponentHandler<ValidateUserExistenceRequest> validateUserHandler; |         private readonly IComponentHandler<ValidateUserExistenceRequest> validateUserHandler; | ||||||
|         private readonly IComponentHandler<GetTokenAdapterRequest> getTokenAdapterHandler; |         private readonly IComponentHandler<GetTokenAdapterRequest> getTokenAdapterHandler; | ||||||
|         private readonly IComponentHandler<GetConsentFormPDFRequest> getConsentFormPDFHandler; |  | ||||||
|         private readonly IComponentHandler<AcceptUserConsentFormRequest> acceptUserConsentFormHandler; |  | ||||||
|         private readonly IUserPort port; |         private readonly IUserPort port; | ||||||
| 
 | 
 | ||||||
|         /// <summary> |         /// <summary> | ||||||
| @@ -47,16 +39,10 @@ namespace Core.Cerberos.Service.API.Controllers | |||||||
|             IComponentHandler<CreateUserRequest> createUserHandler, |             IComponentHandler<CreateUserRequest> createUserHandler, | ||||||
|             IComponentHandler<UpdateUserRequest> updateUserHandler, |             IComponentHandler<UpdateUserRequest> updateUserHandler, | ||||||
|             IComponentHandler<ChangeUserStatusRequest> changeUserStatusHandler, |             IComponentHandler<ChangeUserStatusRequest> changeUserStatusHandler, | ||||||
|             IComponentHandler<AddCompanyToUserRequest> addCompanyToUserHandler, |  | ||||||
|             IComponentHandler<RemoveCompanyFromUserRequest> removeCompanyFromUserHandler, |  | ||||||
|             IComponentHandler<AddProjectToUserRequest> addProjectToUserHandler, |  | ||||||
|             IComponentHandler<RemoveProjectFromUserRequest> removeProjectFromUserHandler, |  | ||||||
|             IComponentHandler<LoginUserRequest> loginUserHandler, |             IComponentHandler<LoginUserRequest> loginUserHandler, | ||||||
|             IComponentHandler<LogoutUserRequest> logoutUserHandler, |             IComponentHandler<LogoutUserRequest> logoutUserHandler, | ||||||
|             IComponentHandler<ValidateUserExistenceRequest> validateUserHandler, |             IComponentHandler<ValidateUserExistenceRequest> validateUserHandler, | ||||||
|             IComponentHandler<GetTokenAdapterRequest> getTokenAdapterHandler, |             IComponentHandler<GetTokenAdapterRequest> getTokenAdapterHandler, | ||||||
|             IComponentHandler<GetConsentFormPDFRequest> getConsentFormPDFHandler, |  | ||||||
|             IComponentHandler<AcceptUserConsentFormRequest> acceptUserConsentFormHandler, |  | ||||||
|             IUserPort port |             IUserPort port | ||||||
|             ) |             ) | ||||||
|         { |         { | ||||||
| @@ -66,16 +52,10 @@ namespace Core.Cerberos.Service.API.Controllers | |||||||
|             this.getAllUsersHandler = getAllUsersHandler; |             this.getAllUsersHandler = getAllUsersHandler; | ||||||
|             this.getUserHandler = getUserHandler; |             this.getUserHandler = getUserHandler; | ||||||
|             this.getUserByEmailHandler = getUserByEmailHandler; |             this.getUserByEmailHandler = getUserByEmailHandler; | ||||||
|             this.addCompanyToUserHandler = addCompanyToUserHandler; |  | ||||||
|             this.removeCompanyFromUserHandler = removeCompanyFromUserHandler; |  | ||||||
|             this.addProjectToUserHandler = addProjectToUserHandler; |  | ||||||
|             this.removeProjectFromUserHandler = removeProjectFromUserHandler; |  | ||||||
|             this.loginUserHandler = loginUserHandler; |             this.loginUserHandler = loginUserHandler; | ||||||
|             this.logoutUserHandler = logoutUserHandler; |             this.logoutUserHandler = logoutUserHandler; | ||||||
|             this.validateUserHandler = validateUserHandler; |             this.validateUserHandler = validateUserHandler; | ||||||
|             this.getTokenAdapterHandler = getTokenAdapterHandler; |             this.getTokenAdapterHandler = getTokenAdapterHandler; | ||||||
|             this.getConsentFormPDFHandler = getConsentFormPDFHandler; |  | ||||||
|             this.acceptUserConsentFormHandler = acceptUserConsentFormHandler; |  | ||||||
|             this.port = port; |             this.port = port; | ||||||
|         } |         } | ||||||
|         /// <summary> |         /// <summary> | ||||||
| @@ -90,7 +70,7 @@ namespace Core.Cerberos.Service.API.Controllers | |||||||
|         [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] |         [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] | ||||||
|         [ProducesResponseType(StatusCodes.Status500InternalServerError)] |         [ProducesResponseType(StatusCodes.Status500InternalServerError)] | ||||||
|         [ProducesResponseType(StatusCodes.Status400BadRequest)] |         [ProducesResponseType(StatusCodes.Status400BadRequest)] | ||||||
|         [Authorize(AuthenticationSchemes = Schemes.HeathScheme)] |         [Authorize(AuthenticationSchemes = Schemes.DefaultScheme)] | ||||||
|         [Permission("UserManagement.Read")] |         [Permission("UserManagement.Read")] | ||||||
|         public async Task<IActionResult> GetAllUsersAsync(CancellationToken cancellationToken) |         public async Task<IActionResult> GetAllUsersAsync(CancellationToken cancellationToken) | ||||||
|         { |         { | ||||||
| @@ -111,7 +91,7 @@ namespace Core.Cerberos.Service.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.HeathScheme)] |         [Authorize(AuthenticationSchemes = Schemes.DefaultScheme)] | ||||||
|         [Permission("UserManagement.Read")] |         [Permission("UserManagement.Read")] | ||||||
|         public async Task<IActionResult> GetUserById([FromBody] GetUserRequest request, CancellationToken cancellationToken) |         public async Task<IActionResult> GetUserById([FromBody] GetUserRequest request, CancellationToken cancellationToken) | ||||||
|         { |         { | ||||||
| @@ -134,7 +114,7 @@ namespace Core.Cerberos.Service.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.HeathScheme}, {Schemes.AzureScheme}")] |         [Authorize(AuthenticationSchemes = $"{Schemes.DefaultScheme}, {Schemes.GoogleScheme}")] | ||||||
|         public async Task<IActionResult> GetUserByEmail([FromBody] GetUserByEmailRequest request, CancellationToken cancellationToken) |         public async Task<IActionResult> GetUserByEmail([FromBody] GetUserByEmailRequest request, CancellationToken cancellationToken) | ||||||
|         { |         { | ||||||
|             if (string.IsNullOrEmpty(request.Email)) { return BadRequest("Invalid user email"); } |             if (string.IsNullOrEmpty(request.Email)) { return BadRequest("Invalid user email"); } | ||||||
| @@ -156,7 +136,7 @@ namespace Core.Cerberos.Service.API.Controllers | |||||||
|         [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] |         [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] | ||||||
|         [ProducesResponseType(StatusCodes.Status500InternalServerError)] |         [ProducesResponseType(StatusCodes.Status500InternalServerError)] | ||||||
|         [ProducesResponseType(StatusCodes.Status400BadRequest)] |         [ProducesResponseType(StatusCodes.Status400BadRequest)] | ||||||
|         [Authorize(AuthenticationSchemes = Schemes.HeathScheme)] |         [Authorize(AuthenticationSchemes = Schemes.DefaultScheme)] | ||||||
|         [Permission("UserManagement.Write")] |         [Permission("UserManagement.Write")] | ||||||
|         public async Task<IActionResult> CreateUserAsync([FromBody] CreateUserRequest newUser, CancellationToken cancellationToken = default) |         public async Task<IActionResult> CreateUserAsync([FromBody] CreateUserRequest newUser, CancellationToken cancellationToken = default) | ||||||
|         { |         { | ||||||
| @@ -176,7 +156,7 @@ namespace Core.Cerberos.Service.API.Controllers | |||||||
|         [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] |         [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] | ||||||
|         [ProducesResponseType(StatusCodes.Status500InternalServerError)] |         [ProducesResponseType(StatusCodes.Status500InternalServerError)] | ||||||
|         [ProducesResponseType(StatusCodes.Status400BadRequest)] |         [ProducesResponseType(StatusCodes.Status400BadRequest)] | ||||||
|         [Authorize(AuthenticationSchemes = Schemes.HeathScheme)] |         [Authorize(AuthenticationSchemes = Schemes.DefaultScheme)] | ||||||
|         [Permission("UserManagement.Write")] |         [Permission("UserManagement.Write")] | ||||||
|         public async Task<IActionResult> UpdateUserAsync([FromBody] UpdateUserRequest request, |         public async Task<IActionResult> UpdateUserAsync([FromBody] UpdateUserRequest request, | ||||||
|                                                          CancellationToken cancellationToken = default) |                                                          CancellationToken cancellationToken = default) | ||||||
| @@ -197,7 +177,7 @@ namespace Core.Cerberos.Service.API.Controllers | |||||||
|         [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] |         [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] | ||||||
|         [ProducesResponseType(StatusCodes.Status400BadRequest)] |         [ProducesResponseType(StatusCodes.Status400BadRequest)] | ||||||
|         [ProducesResponseType(StatusCodes.Status500InternalServerError)] |         [ProducesResponseType(StatusCodes.Status500InternalServerError)] | ||||||
|         [Authorize(AuthenticationSchemes = $"{Schemes.HeathScheme}, {Schemes.AzureScheme}")] |         [Authorize(AuthenticationSchemes = $"{Schemes.DefaultScheme}, {Schemes.GoogleScheme}")] | ||||||
|         public async Task<IActionResult> LoginUserAsync([FromBody] LoginUserRequest request, CancellationToken cancellationToken) |         public async Task<IActionResult> LoginUserAsync([FromBody] LoginUserRequest request, CancellationToken cancellationToken) | ||||||
|         { |         { | ||||||
|             if (string.IsNullOrEmpty(request.Email)) { return BadRequest("Invalid user email"); } |             if (string.IsNullOrEmpty(request.Email)) { return BadRequest("Invalid user email"); } | ||||||
| @@ -239,7 +219,7 @@ namespace Core.Cerberos.Service.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.HeathScheme)] |         [Authorize(AuthenticationSchemes = Schemes.DefaultScheme)] | ||||||
|         [Permission("UserManagement.Write")] |         [Permission("UserManagement.Write")] | ||||||
|         public async Task<IActionResult> ChangeUserStatusAsync([FromBody] ChangeUserStatusRequest request, CancellationToken cancellationToken) |         public async Task<IActionResult> ChangeUserStatusAsync([FromBody] ChangeUserStatusRequest request, CancellationToken cancellationToken) | ||||||
|         { |         { | ||||||
| @@ -250,107 +230,6 @@ namespace Core.Cerberos.Service.API.Controllers | |||||||
|             return port.ViewModel; |             return port.ViewModel; | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         /// <summary> |  | ||||||
|         /// Adds a company to the user's list of companies. |  | ||||||
|         /// </summary> |  | ||||||
|         [HttpPost] |  | ||||||
|         [Route("AddCompany")] |  | ||||||
|         [ProducesResponseType(StatusCodes.Status200OK)] |  | ||||||
|         [ProducesResponseType(StatusCodes.Status204NoContent)] |  | ||||||
|         [ProducesResponseType(StatusCodes.Status400BadRequest)] |  | ||||||
|         [ProducesResponseType(StatusCodes.Status401Unauthorized)] |  | ||||||
|         [ProducesResponseType(typeof(Notification), StatusCodes.Status412PreconditionFailed)] |  | ||||||
|         [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] |  | ||||||
|         [ProducesResponseType(StatusCodes.Status500InternalServerError)] |  | ||||||
|         [Authorize(AuthenticationSchemes = Schemes.HeathScheme)] |  | ||||||
|         [Permission("UserManagement.Write")] |  | ||||||
|         public async Task<IActionResult> AddCompanyToUserAsync([FromBody] AddCompanyToUserRequest request, |  | ||||||
|                                                                CancellationToken cancellationToken) |  | ||||||
|         { |  | ||||||
|             if (string.IsNullOrEmpty(request.UserId)) { return BadRequest("Invalid user identifier"); } |  | ||||||
|             if (string.IsNullOrEmpty(request.CompanyId)) { return BadRequest("Invalid company identifier"); } |  | ||||||
| 
 |  | ||||||
|             await addCompanyToUserHandler.ExecuteAsync(request, cancellationToken); |  | ||||||
| 
 |  | ||||||
|             return port.ViewModel; |  | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|         /// <summary> |  | ||||||
|         /// Removes a company from the user's list of companies. |  | ||||||
|         /// </summary> |  | ||||||
|         [HttpDelete] |  | ||||||
|         [Route("RemoveCompany")] |  | ||||||
|         [ProducesResponseType(StatusCodes.Status200OK)] |  | ||||||
|         [ProducesResponseType(StatusCodes.Status204NoContent)] |  | ||||||
|         [ProducesResponseType(StatusCodes.Status400BadRequest)] |  | ||||||
|         [ProducesResponseType(StatusCodes.Status401Unauthorized)] |  | ||||||
|         [ProducesResponseType(typeof(Notification), StatusCodes.Status412PreconditionFailed)] |  | ||||||
|         [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] |  | ||||||
|         [ProducesResponseType(StatusCodes.Status500InternalServerError)] |  | ||||||
|         [Authorize(AuthenticationSchemes = Schemes.HeathScheme)] |  | ||||||
|         [Permission("UserManagement.Write")] |  | ||||||
|         public async Task<IActionResult> RemoveCompanyFromUserAsync([FromBody] RemoveCompanyFromUserRequest request, |  | ||||||
|                                                                    CancellationToken cancellationToken) |  | ||||||
|         { |  | ||||||
|             if (string.IsNullOrEmpty(request.UserId)) { return BadRequest("Invalid user identifier"); } |  | ||||||
|             if (string.IsNullOrEmpty(request.CompanyId)) { return BadRequest("Invalid company identifier"); } |  | ||||||
| 
 |  | ||||||
|             await removeCompanyFromUserHandler.ExecuteAsync(request, cancellationToken); |  | ||||||
| 
 |  | ||||||
|             return port.ViewModel; |  | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|         /// <summary> |  | ||||||
|         /// Adds a project to the user's list of projects. |  | ||||||
|         /// </summary> |  | ||||||
|         [HttpPost] |  | ||||||
|         [Route("AddProject")] |  | ||||||
|         [ProducesResponseType(StatusCodes.Status200OK)] |  | ||||||
|         [ProducesResponseType(StatusCodes.Status204NoContent)] |  | ||||||
|         [ProducesResponseType(StatusCodes.Status400BadRequest)] |  | ||||||
|         [ProducesResponseType(StatusCodes.Status401Unauthorized)] |  | ||||||
|         [ProducesResponseType(typeof(Notification), StatusCodes.Status412PreconditionFailed)] |  | ||||||
|         [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] |  | ||||||
|         [ProducesResponseType(StatusCodes.Status500InternalServerError)] |  | ||||||
|         [Authorize(AuthenticationSchemes = Schemes.HeathScheme)] |  | ||||||
|         [Permission("UserManagement.Write")] |  | ||||||
|         public async Task<IActionResult> AddProjectToUserAsync([FromBody] AddProjectToUserRequest request, |  | ||||||
|                                                               CancellationToken cancellationToken) |  | ||||||
|         { |  | ||||||
|             if (string.IsNullOrEmpty(request.UserId)) { return BadRequest("Invalid user identifier"); } |  | ||||||
|             if (string.IsNullOrEmpty(request.ProjectId)) { return BadRequest("Invalid project identifier"); } |  | ||||||
| 
 |  | ||||||
|             await addProjectToUserHandler.ExecuteAsync(request, cancellationToken); |  | ||||||
| 
 |  | ||||||
|             return port.ViewModel; |  | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|         /// <summary> |  | ||||||
|         /// Removes a project from the user's list of projects. |  | ||||||
|         /// </summary> |  | ||||||
|         [HttpDelete] |  | ||||||
|         [Route("RemoveProject")] |  | ||||||
|         [ProducesResponseType(StatusCodes.Status200OK)] |  | ||||||
|         [ProducesResponseType(StatusCodes.Status204NoContent)] |  | ||||||
|         [ProducesResponseType(StatusCodes.Status400BadRequest)] |  | ||||||
|         [ProducesResponseType(StatusCodes.Status401Unauthorized)] |  | ||||||
|         [ProducesResponseType(typeof(Notification), StatusCodes.Status412PreconditionFailed)] |  | ||||||
|         [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] |  | ||||||
|         [ProducesResponseType(StatusCodes.Status500InternalServerError)] |  | ||||||
|         [Authorize(AuthenticationSchemes = Schemes.HeathScheme)] |  | ||||||
|         [Permission("UserManagement.Write")] |  | ||||||
|         public async Task<IActionResult> RemoveProjectFromUserAsync([FromBody] RemoveProjectFromUserRequest request, |  | ||||||
|                                                                    CancellationToken cancellationToken) |  | ||||||
|         { |  | ||||||
| 
 |  | ||||||
|             if (string.IsNullOrEmpty(request.UserId)) { return BadRequest("Invalid user identifier"); } |  | ||||||
|             if (string.IsNullOrEmpty(request.ProjectId)) { return BadRequest("Invalid project identifier"); } |  | ||||||
| 
 |  | ||||||
|             await removeProjectFromUserHandler.ExecuteAsync(request, cancellationToken); |  | ||||||
| 
 |  | ||||||
|             return port.ViewModel; |  | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|         /// <summary> |         /// <summary> | ||||||
|         /// Validates if a user exists on the database. |         /// Validates if a user exists on the database. | ||||||
|         /// </summary> |         /// </summary> | ||||||
| @@ -379,7 +258,7 @@ namespace Core.Cerberos.Service.API.Controllers | |||||||
|         [HttpPost] |         [HttpPost] | ||||||
|         [Route("GetTokenAdapter")] |         [Route("GetTokenAdapter")] | ||||||
|         [ProducesResponseType(typeof(TokenAdapter), StatusCodes.Status200OK)] |         [ProducesResponseType(typeof(TokenAdapter), StatusCodes.Status200OK)] | ||||||
|         [Authorize(AuthenticationSchemes = $"{Schemes.HeathScheme}, {Schemes.AzureScheme}")] |         [Authorize(AuthenticationSchemes = $"{Schemes.DefaultScheme}, {Schemes.GoogleScheme}")] | ||||||
|         public async Task<IActionResult> GetTokenAdapter([FromBody] GetTokenAdapterRequest request, CancellationToken cancellationToken) |         public async Task<IActionResult> GetTokenAdapter([FromBody] GetTokenAdapterRequest request, CancellationToken cancellationToken) | ||||||
|         { |         { | ||||||
|             if (string.IsNullOrEmpty(request.Email)) { return BadRequest("Invalid user email"); } |             if (string.IsNullOrEmpty(request.Email)) { return BadRequest("Invalid user email"); } | ||||||
| @@ -388,45 +267,5 @@ namespace Core.Cerberos.Service.API.Controllers | |||||||
| 
 | 
 | ||||||
|             return port.ViewModel; |             return port.ViewModel; | ||||||
|         } |         } | ||||||
| 
 |  | ||||||
|         /// <summary> |  | ||||||
|         /// Get Consent Form PDF. |  | ||||||
|         /// </summary> |  | ||||||
|         [HttpGet] |  | ||||||
|         [Route("GetConsentFormPDF")] |  | ||||||
|         [ProducesResponseType(StatusCodes.Status200OK)] |  | ||||||
|         [ProducesResponseType(StatusCodes.Status204NoContent)] |  | ||||||
|         [ProducesResponseType(StatusCodes.Status401Unauthorized)] |  | ||||||
|         [ProducesResponseType(typeof(Notification), StatusCodes.Status412PreconditionFailed)] |  | ||||||
|         [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] |  | ||||||
|         [ProducesResponseType(StatusCodes.Status500InternalServerError)] |  | ||||||
|         [ProducesResponseType(StatusCodes.Status400BadRequest)] |  | ||||||
|         [Authorize(AuthenticationSchemes = Schemes.HeathScheme)] |  | ||||||
|         [Permission("UserManagement.Read")] |  | ||||||
|         public async Task<IActionResult> GetConsentFormPDFAsync(CancellationToken cancellationToken) |  | ||||||
|         { |  | ||||||
|             await getConsentFormPDFHandler.ExecuteAsync(new GetConsentFormPDFRequest { }, cancellationToken).ConfigureAwait(false); |  | ||||||
| 
 |  | ||||||
|             return port.ViewModel; |  | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|         /// <summary> |  | ||||||
|         /// Accept user consent form. |  | ||||||
|         /// </summary> |  | ||||||
|         [HttpPatch("AcceptUserConsentForm")] |  | ||||||
|         [ProducesResponseType(StatusCodes.Status200OK)] |  | ||||||
|         [ProducesResponseType(StatusCodes.Status204NoContent)] |  | ||||||
|         [ProducesResponseType(StatusCodes.Status401Unauthorized)] |  | ||||||
|         [ProducesResponseType(typeof(Notification), StatusCodes.Status412PreconditionFailed)] |  | ||||||
|         [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] |  | ||||||
|         [ProducesResponseType(StatusCodes.Status400BadRequest)] |  | ||||||
|         [ProducesResponseType(StatusCodes.Status500InternalServerError)] |  | ||||||
|         [Authorize(AuthenticationSchemes = $"{Schemes.HeathScheme}, {Schemes.AzureScheme}")] |  | ||||||
|         public async Task<IActionResult> AcceptUserConsentFormAsync(CancellationToken cancellationToken) |  | ||||||
|         { |  | ||||||
|             await acceptUserConsentFormHandler.ExecuteAsync(new AcceptUserConsentFormRequest { }, cancellationToken).ConfigureAwait(false); |  | ||||||
| 
 |  | ||||||
|             return port.ViewModel; |  | ||||||
|         } |  | ||||||
|     } |     } | ||||||
| } | } | ||||||
| @@ -1,4 +1,4 @@ | |||||||
| <Project Sdk="Microsoft.NET.Sdk.Web"> | <Project Sdk="Microsoft.NET.Sdk.Web"> | ||||||
| 
 | 
 | ||||||
|   <PropertyGroup> |   <PropertyGroup> | ||||||
|     <TargetFramework>net8.0</TargetFramework> |     <TargetFramework>net8.0</TargetFramework> | ||||||
| @@ -8,12 +8,12 @@ | |||||||
|   </PropertyGroup> |   </PropertyGroup> | ||||||
| 
 | 
 | ||||||
|   <ItemGroup> |   <ItemGroup> | ||||||
|     <PackageReference Include="Core.Cerberos.Adapters" Version="0.3.0-alpha0042" /> |     <PackageReference Include="Core.Blueprint.Logging" Version="1.0.1" /> | ||||||
|   </ItemGroup> |   </ItemGroup> | ||||||
| 
 | 
 | ||||||
|   <ItemGroup> |   <ItemGroup> | ||||||
|     <ProjectReference Include="..\Core.Cerberos.Application\Core.Cerberos.Application.csproj" /> |     <ProjectReference Include="..\Core.Thalos.Application\Core.Thalos.Application.csproj" /> | ||||||
|     <ProjectReference Include="..\Core.Cerberos.External\Core.Cerberos.External.csproj" /> |     <ProjectReference Include="..\Core.Thalos.External\Core.Thalos.External.csproj" /> | ||||||
|   </ItemGroup> |   </ItemGroup> | ||||||
| 
 | 
 | ||||||
|   <ItemGroup> |   <ItemGroup> | ||||||
							
								
								
									
										126
									
								
								Core.Thalos.Service.API/Extensions/ServiceCollectionExtension.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										126
									
								
								Core.Thalos.Service.API/Extensions/ServiceCollectionExtension.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,126 @@ | |||||||
|  | using Core.Thalos.Application.UseCases.Modules; | ||||||
|  | using Core.Thalos.Application.UseCases.Modules.Adapter; | ||||||
|  | using Core.Thalos.Application.UseCases.Modules.Input; | ||||||
|  | using Core.Thalos.Application.UseCases.Modules.Ports; | ||||||
|  | using Core.Thalos.Application.UseCases.Modules.Validator; | ||||||
|  | using Core.Thalos.Application.UseCases.Permissions; | ||||||
|  | using Core.Thalos.Application.UseCases.Permissions.Adapter; | ||||||
|  | using Core.Thalos.Application.UseCases.Permissions.Input; | ||||||
|  | using Core.Thalos.Application.UseCases.Permissions.Ports; | ||||||
|  | using Core.Thalos.Application.UseCases.Permissions.Validator; | ||||||
|  | using Core.Thalos.Application.UseCases.Role; | ||||||
|  | using Core.Thalos.Application.UseCases.Roles.Adapter; | ||||||
|  | using Core.Thalos.Application.UseCases.Roles.Input; | ||||||
|  | using Core.Thalos.Application.UseCases.Roles.Ports; | ||||||
|  | using Core.Thalos.Application.UseCases.Roles.Validator; | ||||||
|  | using Core.Thalos.Application.UseCases.Users; | ||||||
|  | using Core.Thalos.Application.UseCases.Users.Adapter; | ||||||
|  | using Core.Thalos.Application.UseCases.Users.Input; | ||||||
|  | using Core.Thalos.Application.UseCases.Users.Ports; | ||||||
|  | using Core.Thalos.Application.UseCases.Users.Validator; | ||||||
|  | using FluentValidation; | ||||||
|  | using Lib.Architecture.BuildingBlocks; | ||||||
|  |  | ||||||
|  | namespace Core.Thalos.Service.API.Extensions | ||||||
|  | { | ||||||
|  |     public static class ServiceCollectionExtension | ||||||
|  |     { | ||||||
|  |         public static IServiceCollection AddServiceConfigurationLayer(this IServiceCollection services) | ||||||
|  |         { | ||||||
|  |             #region User Services | ||||||
|  |  | ||||||
|  |             services.AddScoped<IUserPort, UserPort>(); | ||||||
|  |             services.AddScoped<IComponentHandler<GetAllUsersRequest>, UserHandler>(); | ||||||
|  |             services.AddScoped<IComponentHandler<GetUserRequest>, UserHandler>(); | ||||||
|  |             services.AddScoped<IComponentHandler<LoginUserRequest>, UserHandler>(); | ||||||
|  |             services.AddScoped<IComponentHandler<LogoutUserRequest>, UserHandler>(); | ||||||
|  |             services.AddScoped<IComponentHandler<GetUserByEmailRequest>, UserHandler>(); | ||||||
|  |             services.AddScoped<IComponentHandler<ValidateUserExistenceRequest>, UserHandler>(); | ||||||
|  |             services.AddScoped<IComponentHandler<GetTokenAdapterRequest>, UserHandler>(); | ||||||
|  |  | ||||||
|  |  | ||||||
|  |             services.AddValidatorsFromAssemblyContaining<CreateUserValidator>(); | ||||||
|  |             services.AddScoped<IValidator<CreateUserRequest>, CreateUserValidator>(); | ||||||
|  |             services.AddScoped<IComponentHandler<CreateUserRequest>, UserHandler>(); | ||||||
|  |  | ||||||
|  |             services.AddValidatorsFromAssemblyContaining<UpdateUserValidator>(); | ||||||
|  |             services.AddScoped<IValidator<UpdateUserRequest>, UpdateUserValidator>(); | ||||||
|  |             services.AddScoped<IComponentHandler<UpdateUserRequest>, UserHandler>(); | ||||||
|  |  | ||||||
|  |             services.AddValidatorsFromAssemblyContaining<ChangeUserStatusValidator>(); | ||||||
|  |             services.AddScoped<IValidator<ChangeUserStatusRequest>, ChangeUserStatusValidator>(); | ||||||
|  |             services.AddScoped<IComponentHandler<ChangeUserStatusRequest>, UserHandler>(); | ||||||
|  |  | ||||||
|  |             #endregion | ||||||
|  |  | ||||||
|  |             #region Role Services | ||||||
|  |  | ||||||
|  |             services.AddScoped<IRolePort, RolePort>(); | ||||||
|  |             services.AddScoped<IComponentHandler<GetAllRolesRequest>, RoleHandler>(); | ||||||
|  |             services.AddScoped<IComponentHandler<GetRoleRequest>, RoleHandler>(); | ||||||
|  |             services.AddScoped<IComponentHandler<AddApplicationToRoleRequest>, RoleHandler>(); | ||||||
|  |             services.AddScoped<IComponentHandler<RemoveApplicationFromRoleRequest>, RoleHandler>(); | ||||||
|  |  | ||||||
|  |             services.AddValidatorsFromAssemblyContaining<CreateRoleValidator>(); | ||||||
|  |             services.AddScoped<IValidator<CreateRoleRequest>, CreateRoleValidator>(); | ||||||
|  |             services.AddScoped<IComponentHandler<CreateRoleRequest>, RoleHandler>(); | ||||||
|  |  | ||||||
|  |             services.AddValidatorsFromAssemblyContaining<UpdateRoleValidator>(); | ||||||
|  |             services.AddScoped<IValidator<UpdateRoleRequest>, UpdateRoleValidator>(); | ||||||
|  |             services.AddScoped<IComponentHandler<UpdateRoleRequest>, RoleHandler>(); | ||||||
|  |  | ||||||
|  |             services.AddValidatorsFromAssemblyContaining<ChangeRoleStatusValidator>(); | ||||||
|  |             services.AddScoped<IValidator<ChangeRoleStatusRequest>, ChangeRoleStatusValidator>(); | ||||||
|  |             services.AddScoped<IComponentHandler<ChangeRoleStatusRequest>, RoleHandler>(); | ||||||
|  |  | ||||||
|  |             #endregion | ||||||
|  |  | ||||||
|  |             #region Permission Services | ||||||
|  |  | ||||||
|  |             services.AddScoped<IPermissionPort, PermissionPort>(); | ||||||
|  |             services.AddScoped<IComponentHandler<GetAllPermissionsRequest>, PermissionHandler>(); | ||||||
|  |             services.AddScoped<IComponentHandler<GetPermissionRequest>, PermissionHandler>(); | ||||||
|  |             services.AddScoped<IComponentHandler<GetAllPermissionsByListRequest>, PermissionHandler>(); | ||||||
|  |  | ||||||
|  |             services.AddValidatorsFromAssemblyContaining<CreatePermissionValidator>(); | ||||||
|  |             services.AddScoped<IValidator<CreatePermissionRequest>, CreatePermissionValidator>(); | ||||||
|  |             services.AddScoped<IComponentHandler<CreatePermissionRequest>, PermissionHandler>(); | ||||||
|  |  | ||||||
|  |             services.AddValidatorsFromAssemblyContaining<UpdatePermissionValidator>(); | ||||||
|  |             services.AddScoped<IValidator<UpdatePermissionRequest>, UpdatePermissionValidator>(); | ||||||
|  |             services.AddScoped<IComponentHandler<UpdatePermissionRequest>, PermissionHandler>(); | ||||||
|  |  | ||||||
|  |             services.AddValidatorsFromAssemblyContaining<ChangePermissionStatusValidator>(); | ||||||
|  |             services.AddScoped<IValidator<ChangePermissionStatusRequest>, ChangePermissionStatusValidator>(); | ||||||
|  |             services.AddScoped<IComponentHandler<ChangePermissionStatusRequest>, PermissionHandler>(); | ||||||
|  |  | ||||||
|  |             #endregion | ||||||
|  |  | ||||||
|  |             #region Module Services | ||||||
|  |  | ||||||
|  |             services.AddScoped<IModulePort, ModulePort>(); | ||||||
|  |             services.AddScoped<IComponentHandler<GetAllModulesRequest>, ModuleHandler>(); | ||||||
|  |             services.AddScoped<IComponentHandler<GetModuleRequest>, ModuleHandler>(); | ||||||
|  |  | ||||||
|  |             services.AddValidatorsFromAssemblyContaining<GetAllModulesByListValidator>(); | ||||||
|  |             services.AddScoped<IValidator<GetAllModulesByListRequest>, GetAllModulesByListValidator>(); | ||||||
|  |             services.AddScoped<IComponentHandler<GetAllModulesByListRequest>, ModuleHandler>(); | ||||||
|  |  | ||||||
|  |             services.AddValidatorsFromAssemblyContaining<CreateModuleValidator>(); | ||||||
|  |             services.AddScoped<IValidator<CreateModuleRequest>, CreateModuleValidator>(); | ||||||
|  |             services.AddScoped<IComponentHandler<CreateModuleRequest>, ModuleHandler>(); | ||||||
|  |  | ||||||
|  |             services.AddValidatorsFromAssemblyContaining<UpdateModuleValidator>(); | ||||||
|  |             services.AddScoped<IValidator<UpdateModuleRequest>, UpdateModuleValidator>(); | ||||||
|  |             services.AddScoped<IComponentHandler<UpdateModuleRequest>, ModuleHandler>(); | ||||||
|  |  | ||||||
|  |             services.AddValidatorsFromAssemblyContaining<ChangeModuleStatusValidator>(); | ||||||
|  |             services.AddScoped<IValidator<ChangeModuleStatusRequest>, ChangeModuleStatusValidator>(); | ||||||
|  |             services.AddScoped<IComponentHandler<ChangeModuleStatusRequest>, ModuleHandler>(); | ||||||
|  |  | ||||||
|  |             #endregion | ||||||
|  |  | ||||||
|  |             return services; | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | } | ||||||
							
								
								
									
										88
									
								
								Core.Thalos.Service.API/Program.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										88
									
								
								Core.Thalos.Service.API/Program.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,88 @@ | |||||||
|  | using Core.Blueprint.KeyVault.Configuration; | ||||||
|  | using Core.Blueprint.Logging.Configuration; | ||||||
|  | using Core.Thalos.BuildingBlocks; | ||||||
|  | using Core.Thalos.BuildingBlocks.Configuration; | ||||||
|  | using Core.Thalos.External.ClientConfiguration; | ||||||
|  | using Core.Thalos.Service.API.Extensions; | ||||||
|  | using Microsoft.AspNetCore.HttpLogging; | ||||||
|  | using System.Reflection; | ||||||
|  | using System.Text.Json.Serialization; | ||||||
|  |  | ||||||
|  | var builder = WebApplication.CreateBuilder(args); | ||||||
|  |  | ||||||
|  | builder.Configuration | ||||||
|  |     .AddUserSecrets(Assembly.GetExecutingAssembly()) | ||||||
|  |     .AddEnvironmentVariables(); | ||||||
|  |  | ||||||
|  | var services = builder.Services.AddKeyVault(builder.Configuration); | ||||||
|  |  | ||||||
|  | var authSettings = await AuthHelper.GetAuthSettings(builder.Services, builder, "thalos_common"); | ||||||
|  |  | ||||||
|  | builder.Services.ConfigureAuthentication(builder.Configuration, authSettings); | ||||||
|  |  | ||||||
|  | builder.Services.AddLogs(builder); | ||||||
|  |  | ||||||
|  | builder.Services.AddEndpointsApiExplorer(); | ||||||
|  | builder.Services.AddSwaggerGen(builder.Configuration, "Core.Thalos.Service.API.xml", authSettings); | ||||||
|  | builder.Services.AddVersioning(builder.Configuration); | ||||||
|  | builder.Services.RegisterExternalLayer(builder.Configuration); | ||||||
|  | builder.Services.AddServiceConfigurationLayer(); | ||||||
|  | builder.Services.AddResponseCompression(); | ||||||
|  | builder.Services.AddProblemDetails(); | ||||||
|  | builder.Services.AddMemoryCache(); | ||||||
|  |  | ||||||
|  | builder.Host.ConfigureServices((context, services) => | ||||||
|  | { | ||||||
|  |  | ||||||
|  |     services.AddLogging(); | ||||||
|  |     services.AddControllers(); | ||||||
|  |     services.AddProblemDetails(); | ||||||
|  |     services.AddCors(options | ||||||
|  |         => options.AddDefaultPolicy(policyBuilder | ||||||
|  |             => policyBuilder | ||||||
|  |                 .AllowAnyOrigin() | ||||||
|  |                 .AllowAnyHeader() | ||||||
|  |                 .AllowAnyMethod())); | ||||||
|  |  | ||||||
|  |     builder.Services.Configure<Microsoft.AspNetCore.Http.Json.JsonOptions>(options => | ||||||
|  |     { | ||||||
|  |         options.SerializerOptions.Converters.Add(new JsonStringEnumConverter()); | ||||||
|  |     }); | ||||||
|  |  | ||||||
|  |     services.AddHealthChecks(); | ||||||
|  |     services.AddHttpLogging(options => options.LoggingFields = HttpLoggingFields.All); | ||||||
|  |  | ||||||
|  |     builder.Services.AddOutputCache(options => | ||||||
|  |     { | ||||||
|  |         options.AddBasePolicy(builder => | ||||||
|  |             builder.Expire(TimeSpan.FromSeconds(10))); | ||||||
|  |         options.AddPolicy("Expire20", builder => | ||||||
|  |             builder.Expire(TimeSpan.FromSeconds(20))); | ||||||
|  |         options.AddPolicy("Expire30", builder => | ||||||
|  |             builder.Expire(TimeSpan.FromSeconds(30))); | ||||||
|  |     }); | ||||||
|  |  | ||||||
|  | }); | ||||||
|  |  | ||||||
|  | var app = builder.Build(); | ||||||
|  |  | ||||||
|  | app.UseLogging(builder.Configuration); | ||||||
|  | app.UseSwaggerUI(builder.Configuration, authSettings); | ||||||
|  | app.ConfigureSwagger(builder.Configuration); | ||||||
|  |  | ||||||
|  | app.UseRouting(); | ||||||
|  | app.UseCors(); | ||||||
|  | app.UseHttpsRedirection(); | ||||||
|  | app.UseStaticFiles(); | ||||||
|  | app.UseResponseCompression(); | ||||||
|  | app.UseOutputCache(); | ||||||
|  | app.UseResponseCaching(); | ||||||
|  |  | ||||||
|  | app.UseAuthentication(); | ||||||
|  | app.UseAuthorization(); | ||||||
|  |  | ||||||
|  | app.MapControllers(); | ||||||
|  | app.MapHealthChecks("/health"); | ||||||
|  |  | ||||||
|  | app.Run(); | ||||||
|  |  | ||||||
							
								
								
									
										6
									
								
								Core.Thalos.Service.API/Thalos.Service.API.http
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								Core.Thalos.Service.API/Thalos.Service.API.http
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,6 @@ | |||||||
|  | @Core.Thalos.Service.API_HostAddress = http://localhost:5145 | ||||||
|  |  | ||||||
|  | GET {{Core.Thalos.Service.API_HostAddress}}/weatherforecast/ | ||||||
|  | Accept: application/json | ||||||
|  |  | ||||||
|  | ### | ||||||
							
								
								
									
										25
									
								
								Core.Thalos.Service.API/appsettings.Local.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										25
									
								
								Core.Thalos.Service.API/appsettings.Local.json
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,25 @@ | |||||||
|  | { | ||||||
|  |   "Logging": { | ||||||
|  |     "LogLevel": { | ||||||
|  |       "Default": "Information", | ||||||
|  |       "Microsoft.AspNetCore": "Warning" | ||||||
|  |     } | ||||||
|  |   }, | ||||||
|  |   "AllowedHosts": "*", | ||||||
|  |   "LocalGateways": { | ||||||
|  |     "ThalosDAL": "https://localhost:7031/api" | ||||||
|  |   }, | ||||||
|  |   "ServiceSettings": { | ||||||
|  |     "ApplicationName": "thalos", | ||||||
|  |     "LayerName": "service" | ||||||
|  |   }, | ||||||
|  |   "Vault": { | ||||||
|  |     "Address": "http://100.123.31.103:8200", | ||||||
|  |     "Token": "hvs.e37LQvLuPhTd5ALS5QQ03Cwm", | ||||||
|  |     "SecretMount": "secret" | ||||||
|  |   }, | ||||||
|  |   "IdentityProviders": { | ||||||
|  |     "Google": true, | ||||||
|  |     "Azure": true | ||||||
|  |   } | ||||||
|  | } | ||||||
| @@ -5,8 +5,5 @@ | |||||||
|       "Microsoft.AspNetCore": "Warning" |       "Microsoft.AspNetCore": "Warning" | ||||||
|     } |     } | ||||||
|   }, |   }, | ||||||
|   "AllowedHosts": "*", |   "AllowedHosts": "*" | ||||||
|   "LocalGateways": { |  | ||||||
|     "CerberosDAL": "https://localhost:7031/api" |  | ||||||
|   } |  | ||||||
| } | } | ||||||
| @@ -1,6 +1,6 @@ | |||||||
| { | { | ||||||
|   "Gateways": { |   "Gateways": { | ||||||
|     "CerberosDAL": "" // Data access layer endpoint |     "ThalosDAL": "" // Data access layer endpoint | ||||||
|   }, |   }, | ||||||
|   "ConnectionStrings": { |   "ConnectionStrings": { | ||||||
|     "KeyVault": "" //KeyVault Uri |     "KeyVault": "" //KeyVault Uri | ||||||
| @@ -17,11 +17,11 @@ | |||||||
|     "CallbackPath": "", // Path for redirect after authentication |     "CallbackPath": "", // Path for redirect after authentication | ||||||
|     "Scopes": "" // Access scopes for user permissions |     "Scopes": "" // Access scopes for user permissions | ||||||
|   }, |   }, | ||||||
|   "HeathCerberosApp": { |   "ThalosApp": { | ||||||
|     "AuthorizationUrl": "", // URL for authorization endpoint (STORED IN KEY VAULT) |     "AuthorizationUrl": "", // URL for authorization endpoint (STORED IN KEY VAULT) | ||||||
|     "TokenUrl": "", // URL for token endpoint (STORED IN KEY VAULT) |     "TokenUrl": "", // URL for token endpoint (STORED IN KEY VAULT) | ||||||
|     "Scope": "", // Scope for application permissions (STORED IN KEY VAULT) |     "Scope": "", // Scope for application permissions (STORED IN KEY VAULT) | ||||||
|     "ClientId": "" // Client ID for Cerberos application (STORED IN KEY VAULT) |     "ClientId": "" // Client ID for Thalos application (STORED IN KEY VAULT) | ||||||
|   }, |   }, | ||||||
|   "MicrosoftGraph": { |   "MicrosoftGraph": { | ||||||
|     "Scopes": "", // Scopes for Microsoft Graph API access |     "Scopes": "", // Scopes for Microsoft Graph API access | ||||||
		Reference in New Issue
	
	Block a user