Compare commits
	
		
			13 Commits
		
	
	
		
			feature/im
			...
			f3d63ca0e3
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|   | f3d63ca0e3 | ||
|   | abcddaba9d | ||
| c1637b9e20 | |||
|   | 598081acea | ||
|   | 6d884d0d8b | ||
|   | 4d43ac70cd | ||
| 3b42b60757 | |||
| 4cea65632b | |||
| a9981b6eb3 | |||
| a09540f20a | |||
|   | 55cee7b0d3 | ||
|   | dcf801beff | ||
|   | 82ebe4408b | 
| @@ -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,168 +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.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" | ||||
|   } | ||||
| } | ||||
| @@ -11,7 +11,7 @@ | ||||
|   </ItemGroup> | ||||
| 
 | ||||
|   <ItemGroup> | ||||
|     <ProjectReference Include="..\Core.Cerberos.External\Core.Cerberos.External.csproj" /> | ||||
|     <ProjectReference Include="..\Core.Thalos.External\Core.Thalos.External.csproj" /> | ||||
|   </ItemGroup> | ||||
| 
 | ||||
|   <ItemGroup> | ||||
| @@ -1,9 +1,9 @@ | ||||
| using Core.Cerberos.Adapters; | ||||
| using Core.Cerberos.Application.UseCases.Modules.Ports; | ||||
| using Core.Thalos.Application.UseCases.Modules.Ports; | ||||
| using Core.Thalos.BuildingBlocks; | ||||
| using Lib.Architecture.BuildingBlocks; | ||||
| using Microsoft.AspNetCore.Mvc; | ||||
| 
 | ||||
| namespace Core.Cerberos.Application.UseCases.Modules.Adapter | ||||
| namespace Core.Thalos.Application.UseCases.Modules.Adapter | ||||
| { | ||||
|     public class ModulePort : BasePresenter, IModulePort | ||||
|     { | ||||
| @@ -1,7 +1,7 @@ | ||||
| using Core.Cerberos.Adapters.Common.Enums; | ||||
| using Core.Blueprint.Mongo; | ||||
| using Lib.Architecture.BuildingBlocks; | ||||
| 
 | ||||
| namespace Core.Cerberos.Application.UseCases.Modules.Input | ||||
| namespace Core.Thalos.Application.UseCases.Modules.Input | ||||
| { | ||||
|     public class ChangeModuleStatusRequest : Notificator, ICommand | ||||
|     { | ||||
| @@ -1,7 +1,7 @@ | ||||
| using Core.Cerberos.Adapters.Common.Enums; | ||||
| using Core.Thalos.BuildingBlocks; | ||||
| using Lib.Architecture.BuildingBlocks; | ||||
| 
 | ||||
| namespace Core.Cerberos.Application.UseCases.Modules.Input | ||||
| namespace Core.Thalos.Application.UseCases.Modules.Input | ||||
| { | ||||
|     public class CreateModuleRequest : Notificator, ICommand | ||||
|     { | ||||
| @@ -1,6 +1,6 @@ | ||||
| using Lib.Architecture.BuildingBlocks; | ||||
| 
 | ||||
| namespace Core.Cerberos.Application.UseCases.Modules.Input | ||||
| namespace Core.Thalos.Application.UseCases.Modules.Input | ||||
| { | ||||
|     public class GetAllModulesByListRequest : Notificator, ICommand | ||||
|     { | ||||
| @@ -1,6 +1,6 @@ | ||||
| using Lib.Architecture.BuildingBlocks; | ||||
| 
 | ||||
| namespace Core.Cerberos.Application.UseCases.Modules.Input | ||||
| namespace Core.Thalos.Application.UseCases.Modules.Input | ||||
| { | ||||
|     public class GetAllModulesRequest : ICommand | ||||
|     { | ||||
| @@ -1,6 +1,6 @@ | ||||
| using Lib.Architecture.BuildingBlocks; | ||||
| 
 | ||||
| namespace Core.Cerberos.Application.UseCases.Modules.Input | ||||
| namespace Core.Thalos.Application.UseCases.Modules.Input | ||||
| { | ||||
|     public class GetModuleRequest : Notificator, ICommand | ||||
|     { | ||||
| @@ -1,7 +1,7 @@ | ||||
| using Core.Cerberos.Adapters.Common.Enums; | ||||
| using Core.Thalos.BuildingBlocks; | ||||
| using Lib.Architecture.BuildingBlocks; | ||||
| 
 | ||||
| namespace Core.Cerberos.Application.UseCases.Modules.Input | ||||
| namespace Core.Thalos.Application.UseCases.Modules.Input | ||||
| { | ||||
|     public class UpdateModuleRequest : Notificator, ICommand | ||||
|     { | ||||
| @@ -12,7 +12,6 @@ namespace Core.Cerberos.Application.UseCases.Modules.Input | ||||
|         public string Route { get; set; } = null!; | ||||
|         public int? Order { get; set; } | ||||
|         public ApplicationsEnum? Application { get; set; } = null!; | ||||
|         public StatusEnum Status { get; set; } | ||||
|         public bool Validate() | ||||
|         { | ||||
|             return Id != null; | ||||
| @@ -1,13 +1,13 @@ | ||||
| using Core.Cerberos.Adapters; | ||||
| using Core.Cerberos.Application.UseCases.Modules.Input; | ||||
| using Core.Cerberos.Application.UseCases.Modules.Ports; | ||||
| using Core.Cerberos.External.Clients; | ||||
| using Core.Cerberos.External.Clients.Requests; | ||||
| using Core.Thalos.Application.UseCases.Modules.Input; | ||||
| using Core.Thalos.Application.UseCases.Modules.Ports; | ||||
| using Core.Thalos.BuildingBlocks; | ||||
| using Core.Thalos.External.Clients; | ||||
| using Core.Thalos.External.Clients.Requests; | ||||
| using FluentValidation; | ||||
| using Lib.Architecture.BuildingBlocks; | ||||
| using Lib.Architecture.BuildingBlocks.Helpers; | ||||
| 
 | ||||
| namespace Core.Cerberos.Application.UseCases.Modules | ||||
| namespace Core.Thalos.Application.UseCases.Modules | ||||
| { | ||||
|     public class ModuleHandler : | ||||
|         IComponentHandler<ChangeModuleStatusRequest>, | ||||
| @@ -22,7 +22,7 @@ namespace Core.Cerberos.Application.UseCases.Modules | ||||
|         private readonly IValidator<CreateModuleRequest> _registerModuleValidator; | ||||
|         private readonly IValidator<UpdateModuleRequest> _updateModuleValidator; | ||||
|         private readonly IValidator<GetAllModulesByListRequest> _modulesByListValidator; | ||||
|         private readonly ICerberosServiceClient _cerberosDALService; | ||||
|         private readonly IThalosServiceClient _thalosDALService; | ||||
| 
 | ||||
|         public ModuleHandler( | ||||
|             IModulePort port, | ||||
| @@ -30,13 +30,13 @@ namespace Core.Cerberos.Application.UseCases.Modules | ||||
|             IValidator<CreateModuleRequest> registerModuleValidator, | ||||
|             IValidator<UpdateModuleRequest> updateModuleValidator, | ||||
|             IValidator<GetAllModulesByListRequest> modulesByListValidator, | ||||
|             ICerberosServiceClient cerberosDALService) | ||||
|             IThalosServiceClient thalosDALService) | ||||
|         { | ||||
|             _port = port ?? throw new ArgumentNullException(nameof(port)); | ||||
|             _changeModuleStatusValidator = changeModuleStatusValidator ?? throw new ArgumentNullException(nameof(changeModuleStatusValidator)); | ||||
|             _registerModuleValidator = registerModuleValidator ?? throw new ArgumentNullException(nameof(registerModuleValidator)); | ||||
|             _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)); | ||||
|         } | ||||
| 
 | ||||
| @@ -46,7 +46,7 @@ namespace Core.Cerberos.Application.UseCases.Modules | ||||
|             { | ||||
|                 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) | ||||
|                 { | ||||
| @@ -68,7 +68,7 @@ namespace Core.Cerberos.Application.UseCases.Modules | ||||
|             { | ||||
|                 ArgumentNullException.ThrowIfNull(command); | ||||
| 
 | ||||
|                 var _result = await _cerberosDALService.GetAllModulesAsync().ConfigureAwait(false); | ||||
|                 var _result = await _thalosDALService.GetAllModulesAsync().ConfigureAwait(false); | ||||
|                 if (!_result.Any()) | ||||
|                 { | ||||
|                     _port.NoContentSuccess(); | ||||
| @@ -94,7 +94,7 @@ namespace Core.Cerberos.Application.UseCases.Modules | ||||
|                     return; | ||||
|                 } | ||||
| 
 | ||||
|                 var _result = await _cerberosDALService.GetAllModulesByListAsync(command.Modules, cancellationToken).ConfigureAwait(false); | ||||
|                 var _result = await _thalosDALService.GetAllModulesByListAsync(command.Modules, cancellationToken).ConfigureAwait(false); | ||||
|                 if (!_result.Any()) | ||||
|                 { | ||||
|                     _port.NoContentSuccess(); | ||||
| @@ -120,7 +120,7 @@ namespace Core.Cerberos.Application.UseCases.Modules | ||||
|                     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) | ||||
|                 { | ||||
| @@ -158,7 +158,7 @@ namespace Core.Cerberos.Application.UseCases.Modules | ||||
|                     Application = command.Application, | ||||
|                 }; | ||||
| 
 | ||||
|                 var result = await _cerberosDALService.CreateModuleAsync(request, cancellationToken).ConfigureAwait(false); | ||||
|                 var result = await _thalosDALService.CreateModuleAsync(request, cancellationToken).ConfigureAwait(false); | ||||
| 
 | ||||
|                 if (result == null) | ||||
|                 { | ||||
| @@ -194,13 +194,12 @@ namespace Core.Cerberos.Application.UseCases.Modules | ||||
|                     Application = command.Application, | ||||
|                     Route = command.Route, | ||||
|                     Order = command.Order, | ||||
|                     Icon = command.Icon, | ||||
|                     Status = command.Status | ||||
|                     Icon = command.Icon | ||||
|                 }; | ||||
| 
 | ||||
|                 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) | ||||
|                 { | ||||
| @@ -1,7 +1,7 @@ | ||||
| using Core.Cerberos.Adapters; | ||||
| using Core.Thalos.BuildingBlocks; | ||||
| using Lib.Architecture.BuildingBlocks; | ||||
| 
 | ||||
| namespace Core.Cerberos.Application.UseCases.Modules.Ports | ||||
| namespace Core.Thalos.Application.UseCases.Modules.Ports | ||||
| { | ||||
|     public interface IModulePort : IBasePort, | ||||
|         ICommandSuccessPort<ModuleAdapter>, | ||||
| @@ -1,7 +1,7 @@ | ||||
| using Core.Cerberos.Application.UseCases.Modules.Input; | ||||
| using Core.Thalos.Application.UseCases.Modules.Input; | ||||
| using FluentValidation; | ||||
| 
 | ||||
| namespace Core.Cerberos.Application.UseCases.Modules.Validator | ||||
| namespace Core.Thalos.Application.UseCases.Modules.Validator | ||||
| { | ||||
|     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; | ||||
| 
 | ||||
| namespace Core.Cerberos.Application.UseCases.Modules.Validator | ||||
| namespace Core.Thalos.Application.UseCases.Modules.Validator | ||||
| { | ||||
|     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; | ||||
| 
 | ||||
| namespace Core.Cerberos.Application.UseCases.Modules.Validator | ||||
| namespace Core.Thalos.Application.UseCases.Modules.Validator | ||||
| { | ||||
|     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; | ||||
| 
 | ||||
| namespace Core.Cerberos.Application.UseCases.Modules.Validator | ||||
| namespace Core.Thalos.Application.UseCases.Modules.Validator | ||||
| { | ||||
|     public class UpdateModuleValidator : AbstractValidator<UpdateModuleRequest> | ||||
|     { | ||||
| @@ -1,9 +1,9 @@ | ||||
| using Core.Cerberos.Adapters; | ||||
| using Core.Cerberos.Application.UseCases.Permissions.Ports; | ||||
| using Core.Thalos.Application.UseCases.Permissions.Ports; | ||||
| using Core.Thalos.BuildingBlocks; | ||||
| using Lib.Architecture.BuildingBlocks; | ||||
| using Microsoft.AspNetCore.Mvc; | ||||
| 
 | ||||
| namespace Core.Cerberos.Application.UseCases.Permissions.Adapter | ||||
| namespace Core.Thalos.Application.UseCases.Permissions.Adapter | ||||
| { | ||||
|     public class PermissionPort : BasePresenter, IPermissionPort | ||||
|     { | ||||
| @@ -1,7 +1,7 @@ | ||||
| using Core.Cerberos.Adapters.Common.Enums; | ||||
| using Core.Blueprint.Mongo; | ||||
| using Lib.Architecture.BuildingBlocks; | ||||
| 
 | ||||
| namespace Core.Cerberos.Application.UseCases.Permissions.Input | ||||
| namespace Core.Thalos.Application.UseCases.Permissions.Input | ||||
| { | ||||
|     public class ChangePermissionStatusRequest : Notificator, ICommand | ||||
|     { | ||||
| @@ -1,7 +1,7 @@ | ||||
| using Core.Cerberos.Adapters.Common.Constants; | ||||
| using Core.Thalos.BuildingBlocks; | ||||
| using Lib.Architecture.BuildingBlocks; | ||||
| 
 | ||||
| namespace Core.Cerberos.Application.UseCases.Permissions.Input | ||||
| namespace Core.Thalos.Application.UseCases.Permissions.Input | ||||
| { | ||||
|     public class CreatePermissionRequest : Notificator, ICommand | ||||
|     { | ||||
| @@ -1,6 +1,6 @@ | ||||
| using Lib.Architecture.BuildingBlocks; | ||||
| 
 | ||||
| namespace Core.Cerberos.Application.UseCases.Permissions.Input | ||||
| namespace Core.Thalos.Application.UseCases.Permissions.Input | ||||
| { | ||||
|     public class GetAllPermissionsByListRequest : ICommand | ||||
|     { | ||||
| @@ -1,6 +1,6 @@ | ||||
| using Lib.Architecture.BuildingBlocks; | ||||
| 
 | ||||
| namespace Core.Cerberos.Application.UseCases.Permissions.Input | ||||
| namespace Core.Thalos.Application.UseCases.Permissions.Input | ||||
| { | ||||
|     public class GetAllPermissionsRequest : ICommand | ||||
|     { | ||||
| @@ -1,6 +1,6 @@ | ||||
| using Lib.Architecture.BuildingBlocks; | ||||
| 
 | ||||
| namespace Core.Cerberos.Application.UseCases.Permissions.Input | ||||
| namespace Core.Thalos.Application.UseCases.Permissions.Input | ||||
| { | ||||
|     public class GetPermissionRequest : Notificator, ICommand | ||||
|     { | ||||
| @@ -1,8 +1,7 @@ | ||||
| using Core.Cerberos.Adapters.Common.Constants; | ||||
| using Core.Cerberos.Adapters.Common.Enums; | ||||
| using Core.Thalos.BuildingBlocks; | ||||
| using Lib.Architecture.BuildingBlocks; | ||||
| 
 | ||||
| namespace Core.Cerberos.Application.UseCases.Permissions.Input | ||||
| namespace Core.Thalos.Application.UseCases.Permissions.Input | ||||
| { | ||||
|     public class UpdatePermissionRequest : Notificator, ICommand | ||||
|     { | ||||
| @@ -10,7 +9,7 @@ namespace Core.Cerberos.Application.UseCases.Permissions.Input | ||||
|         public string Name { get; set; } = null!; | ||||
|         public string? Description { get; set; } | ||||
|         public AccessLevelEnum? AccessLevel { get; set; } = null!; | ||||
|         public StatusEnum Status { get; set; } | ||||
|         public Blueprint.Mongo.StatusEnum Status { get; set; } | ||||
|         public bool Validate() | ||||
|         { | ||||
|             return Id != null; | ||||
| @@ -1,13 +1,13 @@ | ||||
| using Core.Cerberos.Adapters; | ||||
| using Core.Cerberos.Application.UseCases.Permissions.Input; | ||||
| using Core.Cerberos.Application.UseCases.Permissions.Ports; | ||||
| using Core.Cerberos.External.Clients; | ||||
| using Core.Cerberos.External.Clients.Requests; | ||||
| using Core.Thalos.Application.UseCases.Permissions.Input; | ||||
| using Core.Thalos.Application.UseCases.Permissions.Ports; | ||||
| using Core.Thalos.BuildingBlocks; | ||||
| using Core.Thalos.External.Clients; | ||||
| using Core.Thalos.External.Clients.Requests; | ||||
| using FluentValidation; | ||||
| using Lib.Architecture.BuildingBlocks; | ||||
| using Lib.Architecture.BuildingBlocks.Helpers; | ||||
| 
 | ||||
| namespace Core.Cerberos.Application.UseCases.Permissions | ||||
| namespace Core.Thalos.Application.UseCases.Permissions | ||||
| { | ||||
|     public class PermissionHandler : | ||||
|         IComponentHandler<ChangePermissionStatusRequest>, | ||||
| @@ -21,20 +21,20 @@ namespace Core.Cerberos.Application.UseCases.Permissions | ||||
|         private readonly IValidator<ChangePermissionStatusRequest> _changePermissionStatusValidator; | ||||
|         private readonly IValidator<CreatePermissionRequest> _registerPermissionValidator; | ||||
|         private readonly IValidator<UpdatePermissionRequest> _updatePermissionValidator; | ||||
|         private readonly ICerberosServiceClient _cerberosDALService; | ||||
|         private readonly IThalosServiceClient _thalosDALService; | ||||
| 
 | ||||
|         public PermissionHandler( | ||||
|             IPermissionPort port, | ||||
|             IValidator<ChangePermissionStatusRequest> changePermissionStatusValidator, | ||||
|             IValidator<CreatePermissionRequest> registerPermissionValidator, | ||||
|             IValidator<UpdatePermissionRequest> updatePermissionValidator, | ||||
|             ICerberosServiceClient cerberosDALService) | ||||
|             IThalosServiceClient thalosDALService) | ||||
|         { | ||||
|             _port = port ?? throw new ArgumentNullException(nameof(port)); | ||||
|             _changePermissionStatusValidator = changePermissionStatusValidator ?? throw new ArgumentNullException(nameof(changePermissionStatusValidator)); | ||||
|             _registerPermissionValidator = registerPermissionValidator ?? throw new ArgumentNullException(nameof(registerPermissionValidator)); | ||||
|             _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) | ||||
| @@ -43,7 +43,7 @@ namespace Core.Cerberos.Application.UseCases.Permissions | ||||
|             { | ||||
|                 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) | ||||
|                 { | ||||
| @@ -65,7 +65,7 @@ namespace Core.Cerberos.Application.UseCases.Permissions | ||||
|             { | ||||
|                 ArgumentNullException.ThrowIfNull(command); | ||||
| 
 | ||||
|                 var _result = await _cerberosDALService.GetAllPermissionsAsync().ConfigureAwait(false); | ||||
|                 var _result = await _thalosDALService.GetAllPermissionsAsync().ConfigureAwait(false); | ||||
|                 if (!_result.Any()) | ||||
|                 { | ||||
|                     _port.NoContentSuccess(); | ||||
| @@ -85,7 +85,7 @@ namespace Core.Cerberos.Application.UseCases.Permissions | ||||
|             { | ||||
|                 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()) | ||||
|                 { | ||||
|                     _port.NoContentSuccess(); | ||||
| @@ -111,7 +111,7 @@ namespace Core.Cerberos.Application.UseCases.Permissions | ||||
|                     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) | ||||
|                 { | ||||
| @@ -146,7 +146,7 @@ namespace Core.Cerberos.Application.UseCases.Permissions | ||||
|                     AccessLevel = command.AccessLevel | ||||
|                 }; | ||||
| 
 | ||||
|                 var result = await _cerberosDALService.CreatePermissionAsync(request, cancellationToken).ConfigureAwait(false); | ||||
|                 var result = await _thalosDALService.CreatePermissionAsync(request, cancellationToken).ConfigureAwait(false); | ||||
| 
 | ||||
|                 if (result == null) | ||||
|                 { | ||||
| @@ -179,13 +179,12 @@ namespace Core.Cerberos.Application.UseCases.Permissions | ||||
|                     Id = command.Id, | ||||
|                     Name = command.Name, | ||||
|                     Description = command.Description, | ||||
|                     AccessLevel = command.AccessLevel, | ||||
|                     Status = command.Status | ||||
|                     AccessLevel = command.AccessLevel | ||||
|                 }; | ||||
| 
 | ||||
|                 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) | ||||
|                 { | ||||
| @@ -1,7 +1,7 @@ | ||||
| using Core.Cerberos.Adapters; | ||||
| using Core.Thalos.BuildingBlocks; | ||||
| using Lib.Architecture.BuildingBlocks; | ||||
| 
 | ||||
| namespace Core.Cerberos.Application.UseCases.Permissions.Ports | ||||
| namespace Core.Thalos.Application.UseCases.Permissions.Ports | ||||
| { | ||||
|     public interface IPermissionPort : IBasePort, | ||||
|         ICommandSuccessPort<PermissionAdapter>, | ||||
| @@ -1,7 +1,7 @@ | ||||
| using Core.Cerberos.Application.UseCases.Permissions.Input; | ||||
| using Core.Thalos.Application.UseCases.Permissions.Input; | ||||
| using FluentValidation; | ||||
| 
 | ||||
| namespace Core.Cerberos.Application.UseCases.Permissions.Validator | ||||
| namespace Core.Thalos.Application.UseCases.Permissions.Validator | ||||
| { | ||||
|     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; | ||||
| 
 | ||||
| namespace Core.Cerberos.Application.UseCases.Permissions.Validator | ||||
| namespace Core.Thalos.Application.UseCases.Permissions.Validator | ||||
| { | ||||
|     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; | ||||
| 
 | ||||
| namespace Core.Cerberos.Application.UseCases.Permissions.Validator | ||||
| namespace Core.Thalos.Application.UseCases.Permissions.Validator | ||||
| { | ||||
|     public class UpdatePermissionValidator : AbstractValidator<UpdatePermissionRequest> | ||||
|     { | ||||
| @@ -1,9 +1,9 @@ | ||||
| using Core.Cerberos.Adapters; | ||||
| using Core.Cerberos.Application.UseCases.Roles.Ports; | ||||
| using Core.Thalos.Application.UseCases.Roles.Ports; | ||||
| using Core.Thalos.BuildingBlocks; | ||||
| using Lib.Architecture.BuildingBlocks; | ||||
| using Microsoft.AspNetCore.Mvc; | ||||
| 
 | ||||
| namespace Core.Cerberos.Application.UseCases.Roles.Adapter | ||||
| namespace Core.Thalos.Application.UseCases.Roles.Adapter | ||||
| { | ||||
|     public class RolePort : BasePresenter, IRolePort | ||||
|     { | ||||
| @@ -1,7 +1,7 @@ | ||||
| using Core.Cerberos.Adapters.Common.Enums; | ||||
| using Core.Thalos.BuildingBlocks; | ||||
| using Lib.Architecture.BuildingBlocks; | ||||
| 
 | ||||
| namespace Core.Cerberos.Application.UseCases.Roles.Input | ||||
| namespace Core.Thalos.Application.UseCases.Roles.Input | ||||
| { | ||||
|     public class AddApplicationToRoleRequest : Notificator, ICommand | ||||
|     { | ||||
| @@ -1,7 +1,7 @@ | ||||
| using Core.Cerberos.Adapters.Common.Enums; | ||||
| using Core.Blueprint.Mongo; | ||||
| using Lib.Architecture.BuildingBlocks; | ||||
| 
 | ||||
| namespace Core.Cerberos.Application.UseCases.Roles.Input | ||||
| namespace Core.Thalos.Application.UseCases.Roles.Input | ||||
| { | ||||
|     public class ChangeRoleStatusRequest : Notificator, ICommand | ||||
|     { | ||||
| @@ -1,8 +1,8 @@ | ||||
| using Core.Cerberos.Adapters.Common.Enums; | ||||
| using Core.Thalos.BuildingBlocks; | ||||
| using Lib.Architecture.BuildingBlocks; | ||||
| using System.Text.Json.Serialization; | ||||
| 
 | ||||
| namespace Core.Cerberos.Application.UseCases.Roles.Input | ||||
| namespace Core.Thalos.Application.UseCases.Roles.Input | ||||
| { | ||||
|     public class CreateRoleRequest : Notificator, ICommand | ||||
|     { | ||||
| @@ -1,6 +1,6 @@ | ||||
| using Lib.Architecture.BuildingBlocks; | ||||
| 
 | ||||
| namespace Core.Cerberos.Application.UseCases.Roles.Input | ||||
| namespace Core.Thalos.Application.UseCases.Roles.Input | ||||
| { | ||||
|     public class GetAllRolesRequest : ICommand | ||||
|     { | ||||
| @@ -1,6 +1,6 @@ | ||||
| using Lib.Architecture.BuildingBlocks; | ||||
| 
 | ||||
| namespace Core.Cerberos.Application.UseCases.Roles.Input | ||||
| namespace Core.Thalos.Application.UseCases.Roles.Input | ||||
| { | ||||
|     public class GetRoleRequest : Notificator, ICommand | ||||
|     { | ||||
| @@ -1,7 +1,7 @@ | ||||
| using Core.Cerberos.Adapters.Common.Enums; | ||||
| using Core.Thalos.BuildingBlocks; | ||||
| using Lib.Architecture.BuildingBlocks; | ||||
| 
 | ||||
| namespace Core.Cerberos.Application.UseCases.Roles.Input | ||||
| namespace Core.Thalos.Application.UseCases.Roles.Input | ||||
| { | ||||
|     public class RemoveApplicationFromRoleRequest : Notificator, ICommand | ||||
|     { | ||||
| @@ -1,8 +1,8 @@ | ||||
| using Core.Cerberos.Adapters.Common.Enums; | ||||
| using Core.Thalos.BuildingBlocks; | ||||
| using Lib.Architecture.BuildingBlocks; | ||||
| using System.Text.Json.Serialization; | ||||
| 
 | ||||
| namespace Core.Cerberos.Application.UseCases.Roles.Input | ||||
| namespace Core.Thalos.Application.UseCases.Roles.Input | ||||
| { | ||||
|     public class UpdateRoleRequest : Notificator, ICommand | ||||
|     { | ||||
| @@ -14,7 +14,7 @@ namespace Core.Cerberos.Application.UseCases.Roles.Input | ||||
|         public ApplicationsEnum[]? Applications { get; set; } | ||||
|         public string[] Modules { get; set; } = null!; | ||||
|         public string[] Permissions { get; set; } = null!; | ||||
|         public StatusEnum Status { get; set; } | ||||
|         public Blueprint.Mongo.StatusEnum Status { get; set; } | ||||
| 
 | ||||
|         public bool Validate() | ||||
|         { | ||||
| @@ -1,7 +1,7 @@ | ||||
| using Core.Cerberos.Adapters; | ||||
| using Core.Thalos.BuildingBlocks; | ||||
| using Lib.Architecture.BuildingBlocks; | ||||
| 
 | ||||
| namespace Core.Cerberos.Application.UseCases.Roles.Ports | ||||
| namespace Core.Thalos.Application.UseCases.Roles.Ports | ||||
| { | ||||
|     public interface IRolePort : IBasePort, | ||||
|         ICommandSuccessPort<RoleAdapter>, ICommandSuccessPort<List<RoleAdapter>>, | ||||
| @@ -1,13 +1,13 @@ | ||||
| using Core.Cerberos.Adapters; | ||||
| using Core.Cerberos.Application.UseCases.Roles.Input; | ||||
| using Core.Cerberos.Application.UseCases.Roles.Ports; | ||||
| using Core.Cerberos.External.Clients; | ||||
| using Core.Cerberos.External.Clients.Requests; | ||||
| using Core.Thalos.Application.UseCases.Roles.Input; | ||||
| using Core.Thalos.Application.UseCases.Roles.Ports; | ||||
| using Core.Thalos.BuildingBlocks; | ||||
| using Core.Thalos.External.Clients; | ||||
| using Core.Thalos.External.Clients.Requests; | ||||
| using FluentValidation; | ||||
| using Lib.Architecture.BuildingBlocks; | ||||
| using Lib.Architecture.BuildingBlocks.Helpers; | ||||
| 
 | ||||
| namespace Core.Cerberos.Application.UseCases.Role | ||||
| namespace Core.Thalos.Application.UseCases.Role | ||||
| { | ||||
|     public class RoleHandler : | ||||
|         IComponentHandler<ChangeRoleStatusRequest>, | ||||
| @@ -23,20 +23,20 @@ namespace Core.Cerberos.Application.UseCases.Role | ||||
|         private readonly IValidator<ChangeRoleStatusRequest> _changeRoleStatusValidator; | ||||
|         private readonly IValidator<CreateRoleRequest> _registerRoleValidator; | ||||
|         private readonly IValidator<UpdateRoleRequest> _updateRoleValidator; | ||||
|         private readonly ICerberosServiceClient _cerberosDALService; | ||||
|         private readonly IThalosServiceClient _thalosDALService; | ||||
| 
 | ||||
|         public RoleHandler( | ||||
|             IRolePort port, | ||||
|             IValidator<ChangeRoleStatusRequest> changeRoleStatusValidator, | ||||
|             IValidator<CreateRoleRequest> registerRoleValidator, | ||||
|             IValidator<UpdateRoleRequest> updateRoleValidator, | ||||
|             ICerberosServiceClient cerberosDALService) | ||||
|             IThalosServiceClient thalosDALService) | ||||
|         { | ||||
|             _port = port ?? throw new ArgumentNullException(nameof(port)); | ||||
|             _changeRoleStatusValidator = changeRoleStatusValidator ?? throw new ArgumentNullException(nameof(changeRoleStatusValidator)); | ||||
|             _registerRoleValidator = registerRoleValidator ?? throw new ArgumentNullException(nameof(registerRoleValidator)); | ||||
|             _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) | ||||
| @@ -45,7 +45,7 @@ namespace Core.Cerberos.Application.UseCases.Role | ||||
|             { | ||||
|                 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) | ||||
|                 { | ||||
| @@ -67,7 +67,7 @@ namespace Core.Cerberos.Application.UseCases.Role | ||||
|             { | ||||
|                 ArgumentNullException.ThrowIfNull(command); | ||||
| 
 | ||||
|                 var _result = await _cerberosDALService.GetAllRolesAsync().ConfigureAwait(false); | ||||
|                 var _result = await _thalosDALService.GetAllRolesAsync().ConfigureAwait(false); | ||||
|                 if (!_result.Any()) | ||||
|                 { | ||||
|                     _port.NoContentSuccess(); | ||||
| @@ -93,7 +93,7 @@ namespace Core.Cerberos.Application.UseCases.Role | ||||
|                     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) | ||||
|                 { | ||||
| @@ -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) | ||||
|                 { | ||||
| @@ -166,13 +166,12 @@ namespace Core.Cerberos.Application.UseCases.Role | ||||
|                     Description = command.Description, | ||||
|                     Applications = command.Applications, | ||||
|                     Modules = command.Modules, | ||||
|                     Permissions = command.Permissions, | ||||
|                     Status = command.Status | ||||
|                     Permissions = command.Permissions | ||||
|                 }; | ||||
| 
 | ||||
|                 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) | ||||
|                 { | ||||
| @@ -194,7 +193,7 @@ namespace Core.Cerberos.Application.UseCases.Role | ||||
|             { | ||||
|                 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) | ||||
|                 { | ||||
| @@ -216,7 +215,7 @@ namespace Core.Cerberos.Application.UseCases.Role | ||||
|             { | ||||
|                 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) | ||||
|                 { | ||||
| @@ -1,7 +1,7 @@ | ||||
| using Core.Cerberos.Application.UseCases.Roles.Input; | ||||
| using Core.Thalos.Application.UseCases.Roles.Input; | ||||
| using FluentValidation; | ||||
| 
 | ||||
| namespace Core.Cerberos.Application.UseCases.Roles.Validator | ||||
| namespace Core.Thalos.Application.UseCases.Roles.Validator | ||||
| { | ||||
|     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; | ||||
| 
 | ||||
| namespace Core.Cerberos.Application.UseCases.Roles.Validator | ||||
| namespace Core.Thalos.Application.UseCases.Roles.Validator | ||||
| { | ||||
|     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; | ||||
| 
 | ||||
| namespace Core.Cerberos.Application.UseCases.Roles.Validator | ||||
| namespace Core.Thalos.Application.UseCases.Roles.Validator | ||||
| { | ||||
|     public class UpdateRoleValidator : AbstractValidator<UpdateRoleRequest> | ||||
|     { | ||||
| @@ -1,10 +1,10 @@ | ||||
| using Core.Blueprint.Storage.Adapters; | ||||
| using Core.Cerberos.Adapters; | ||||
| using Core.Cerberos.Application.UseCases.Users.Ports; | ||||
| using Core.Thalos.Application.UseCases.Users.Ports; | ||||
| using Core.Thalos.BuildingBlocks; | ||||
| using Lib.Architecture.BuildingBlocks; | ||||
| using Microsoft.AspNetCore.Mvc; | ||||
| 
 | ||||
| namespace Core.Cerberos.Application.UseCases.Users.Adapter | ||||
| namespace Core.Thalos.Application.UseCases.Users.Adapter | ||||
| { | ||||
|     public class UserPort : BasePresenter, IUserPort | ||||
|     { | ||||
| @@ -1,7 +1,7 @@ | ||||
| using Core.Cerberos.Adapters.Common.Enums; | ||||
| using Core.Blueprint.Mongo; | ||||
| using Lib.Architecture.BuildingBlocks; | ||||
| 
 | ||||
| namespace Core.Cerberos.Application.UseCases.Users.Input | ||||
| namespace Core.Thalos.Application.UseCases.Users.Input | ||||
| { | ||||
|     public class ChangeUserStatusRequest : Notificator, ICommand | ||||
|     { | ||||
| @@ -1,6 +1,6 @@ | ||||
| using Lib.Architecture.BuildingBlocks; | ||||
| 
 | ||||
| namespace Core.Cerberos.Application.UseCases.Users.Input | ||||
| namespace Core.Thalos.Application.UseCases.Users.Input | ||||
| { | ||||
|     public class CreateUserRequest : Notificator, ICommand | ||||
|     { | ||||
| @@ -1,6 +1,6 @@ | ||||
| using Lib.Architecture.BuildingBlocks; | ||||
| 
 | ||||
| namespace Core.Cerberos.Application.UseCases.Users.Input | ||||
| namespace Core.Thalos.Application.UseCases.Users.Input | ||||
| { | ||||
|     public class GetAllUsersRequest : ICommand | ||||
|     { | ||||
| @@ -1,6 +1,6 @@ | ||||
| using Lib.Architecture.BuildingBlocks; | ||||
| 
 | ||||
| namespace Core.Cerberos.Application.UseCases.Users.Input | ||||
| namespace Core.Thalos.Application.UseCases.Users.Input | ||||
| { | ||||
|     public class GetTokenAdapterRequest : Notificator, ICommand | ||||
|     { | ||||
| @@ -1,6 +1,6 @@ | ||||
| using Lib.Architecture.BuildingBlocks; | ||||
| 
 | ||||
| namespace Core.Cerberos.Application.UseCases.Users.Input | ||||
| namespace Core.Thalos.Application.UseCases.Users.Input | ||||
| { | ||||
|     public class GetUserByEmailRequest : Notificator, ICommand | ||||
|     { | ||||
| @@ -1,6 +1,6 @@ | ||||
| using Lib.Architecture.BuildingBlocks; | ||||
| 
 | ||||
| namespace Core.Cerberos.Application.UseCases.Users.Input | ||||
| namespace Core.Thalos.Application.UseCases.Users.Input | ||||
| { | ||||
|     public class GetUserRequest : Notificator, ICommand | ||||
|     { | ||||
| @@ -1,6 +1,6 @@ | ||||
| using Lib.Architecture.BuildingBlocks; | ||||
| 
 | ||||
| namespace Core.Cerberos.Application.UseCases.Users.Input | ||||
| namespace Core.Thalos.Application.UseCases.Users.Input | ||||
| { | ||||
|     public class LoginUserRequest : Notificator, ICommand | ||||
|     { | ||||
| @@ -1,6 +1,6 @@ | ||||
| using Lib.Architecture.BuildingBlocks; | ||||
| 
 | ||||
| namespace Core.Cerberos.Application.UseCases.Users.Input | ||||
| namespace Core.Thalos.Application.UseCases.Users.Input | ||||
| { | ||||
|     public class LogoutUserRequest : Notificator, ICommand | ||||
|     { | ||||
| @@ -1,6 +1,6 @@ | ||||
| using Lib.Architecture.BuildingBlocks; | ||||
| 
 | ||||
| namespace Core.Cerberos.Application.UseCases.Users.Input | ||||
| namespace Core.Thalos.Application.UseCases.Users.Input | ||||
| { | ||||
|     public class UpdateUserRequest : Notificator, ICommand | ||||
|     { | ||||
| @@ -1,6 +1,6 @@ | ||||
| using Lib.Architecture.BuildingBlocks; | ||||
| 
 | ||||
| namespace Core.Cerberos.Application.UseCases.Users.Input | ||||
| namespace Core.Thalos.Application.UseCases.Users.Input | ||||
| { | ||||
|     public class ValidateUserExistenceRequest : Notificator, ICommand | ||||
|     { | ||||
| @@ -1,8 +1,8 @@ | ||||
| using Core.Blueprint.Storage.Adapters; | ||||
| using Core.Cerberos.Adapters; | ||||
| using Core.Thalos.BuildingBlocks; | ||||
| using Lib.Architecture.BuildingBlocks; | ||||
| 
 | ||||
| namespace Core.Cerberos.Application.UseCases.Users.Ports | ||||
| namespace Core.Thalos.Application.UseCases.Users.Ports | ||||
| { | ||||
|     public interface IUserPort : IBasePort, | ||||
|         ICommandSuccessPort<UserAdapter>, | ||||
| @@ -1,12 +1,12 @@ | ||||
| using Core.Cerberos.Adapters; | ||||
| using Core.Cerberos.Application.UseCases.Users.Input; | ||||
| using Core.Cerberos.Application.UseCases.Users.Ports; | ||||
| using Core.Cerberos.External.Clients; | ||||
| using Core.Cerberos.External.Clients.Requests; | ||||
| using Core.Thalos.Application.UseCases.Users.Input; | ||||
| using Core.Thalos.Application.UseCases.Users.Ports; | ||||
| using Core.Thalos.BuildingBlocks; | ||||
| using Core.Thalos.External.Clients; | ||||
| using Core.Thalos.External.Clients.Requests; | ||||
| using FluentValidation; | ||||
| using Lib.Architecture.BuildingBlocks; | ||||
| using Lib.Architecture.BuildingBlocks.Helpers; | ||||
| namespace Core.Cerberos.Application.UseCases.Users | ||||
| namespace Core.Thalos.Application.UseCases.Users | ||||
| { | ||||
|     public class UserHandler : | ||||
|         IComponentHandler<ChangeUserStatusRequest>, | ||||
| @@ -15,10 +15,6 @@ namespace Core.Cerberos.Application.UseCases.Users | ||||
|         IComponentHandler<GetUserRequest>, | ||||
|         IComponentHandler<GetUserByEmailRequest>, | ||||
|         IComponentHandler<CreateUserRequest>, | ||||
|         IComponentHandler<AddProjectToUserRequest>, | ||||
|         IComponentHandler<RemoveProjectFromUserRequest>, | ||||
|         IComponentHandler<AddCompanyToUserRequest>, | ||||
|         IComponentHandler<RemoveCompanyFromUserRequest>, | ||||
|         IComponentHandler<LoginUserRequest>, | ||||
|         IComponentHandler<LogoutUserRequest>, | ||||
|         IComponentHandler<ValidateUserExistenceRequest>, | ||||
| @@ -28,20 +24,20 @@ namespace Core.Cerberos.Application.UseCases.Users | ||||
|         private readonly IValidator<ChangeUserStatusRequest> _changeUserStatusValidator; | ||||
|         private readonly IValidator<CreateUserRequest> _registerUserValidator; | ||||
|         private readonly IValidator<UpdateUserRequest> _updateUserValidator; | ||||
|         private readonly ICerberosServiceClient _cerberosDALService; | ||||
|         private readonly IThalosServiceClient _thalosDALService; | ||||
| 
 | ||||
|         public UserHandler( | ||||
|             IUserPort port, | ||||
|             IValidator<ChangeUserStatusRequest> changeUserStatusValidator, | ||||
|             IValidator<CreateUserRequest> registerUserValidator, | ||||
|             IValidator<UpdateUserRequest> updateUserValidator, | ||||
|             ICerberosServiceClient cerberosDALService) | ||||
|             IThalosServiceClient thalosDALService) | ||||
|         { | ||||
|             _port = port ?? throw new ArgumentNullException(nameof(port)); | ||||
|             _changeUserStatusValidator = changeUserStatusValidator ?? throw new ArgumentNullException(nameof(changeUserStatusValidator)); | ||||
|             _registerUserValidator = registerUserValidator ?? throw new ArgumentNullException(nameof(registerUserValidator)); | ||||
|             _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) | ||||
| @@ -50,7 +46,7 @@ namespace Core.Cerberos.Application.UseCases.Users | ||||
|             { | ||||
|                 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) | ||||
|                 { | ||||
| @@ -72,7 +68,7 @@ namespace Core.Cerberos.Application.UseCases.Users | ||||
|             { | ||||
|                 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) | ||||
|                 { | ||||
| @@ -94,7 +90,7 @@ namespace Core.Cerberos.Application.UseCases.Users | ||||
|             { | ||||
|                 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) | ||||
|                 { | ||||
| @@ -116,7 +112,7 @@ namespace Core.Cerberos.Application.UseCases.Users | ||||
|             { | ||||
|                 ArgumentNullException.ThrowIfNull(command); | ||||
| 
 | ||||
|                 var _result = await _cerberosDALService.GetAllUsersAsync().ConfigureAwait(false); | ||||
|                 var _result = await _thalosDALService.GetAllUsersAsync().ConfigureAwait(false); | ||||
|                 if (!_result.Any()) | ||||
|                 { | ||||
|                     _port.NoContentSuccess(); | ||||
| @@ -142,7 +138,7 @@ namespace Core.Cerberos.Application.UseCases.Users | ||||
|                     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) | ||||
|                 { | ||||
| @@ -177,11 +173,9 @@ namespace Core.Cerberos.Application.UseCases.Users | ||||
|                     MiddleName = command.MiddleName, | ||||
|                     LastName = command.LastName, | ||||
|                     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) | ||||
|                 { | ||||
| @@ -217,11 +211,9 @@ namespace Core.Cerberos.Application.UseCases.Users | ||||
|                     MiddleName = command.MiddleName, | ||||
|                     LastName = command.LastName, | ||||
|                     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) | ||||
|                 { | ||||
| @@ -243,7 +235,7 @@ namespace Core.Cerberos.Application.UseCases.Users | ||||
|             { | ||||
|                 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) | ||||
|                 { | ||||
| @@ -265,95 +257,7 @@ namespace Core.Cerberos.Application.UseCases.Users | ||||
|             { | ||||
|                 ArgumentNullException.ThrowIfNull(command); | ||||
| 
 | ||||
|                 var result = await _cerberosDALService.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); | ||||
|                 var result = await _thalosDALService.LogoutUserAsync(command.Email, cancellationToken).ConfigureAwait(false); | ||||
| 
 | ||||
|                 if (result == null) | ||||
|                 { | ||||
| @@ -375,7 +279,7 @@ namespace Core.Cerberos.Application.UseCases.Users | ||||
|             { | ||||
|                 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) | ||||
| @@ -1,7 +1,7 @@ | ||||
| using Core.Cerberos.Application.UseCases.Users.Input; | ||||
| using Core.Thalos.Application.UseCases.Users.Input; | ||||
| using FluentValidation; | ||||
| 
 | ||||
| namespace Core.Cerberos.Application.UseCases.Users.Validator | ||||
| namespace Core.Thalos.Application.UseCases.Users.Validator | ||||
| { | ||||
|     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; | ||||
| 
 | ||||
| namespace Core.Cerberos.Application.UseCases.Users.Validator | ||||
| namespace Core.Thalos.Application.UseCases.Users.Validator | ||||
| { | ||||
|     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; | ||||
| 
 | ||||
| namespace Core.Cerberos.Application.UseCases.Users.Validator | ||||
| namespace Core.Thalos.Application.UseCases.Users.Validator | ||||
| { | ||||
|     public class UpdateUserValidator : AbstractValidator<UpdateUserRequest> | ||||
|     { | ||||
| @@ -1,6 +1,6 @@ | ||||
| using Core.Cerberos.External.Clients; | ||||
| using Core.Cerberos.External.GatewayConfigurations; | ||||
| using Core.Cerberos.External.Helpers.Token; | ||||
| using Core.Thalos.External.Clients; | ||||
| using Core.Thalos.External.GatewayConfigurations; | ||||
| using Core.Thalos.External.Helpers.Token; | ||||
| using Lib.Architecture.BuildingBlocks; | ||||
| using Microsoft.AspNetCore.Authentication; | ||||
| using Microsoft.AspNetCore.Http; | ||||
| @@ -8,7 +8,7 @@ using Microsoft.Extensions.Configuration; | ||||
| using Microsoft.Extensions.DependencyInjection; | ||||
| using Refit; | ||||
| 
 | ||||
| namespace Core.Cerberos.External.ClientConfiguration | ||||
| namespace Core.Thalos.External.ClientConfiguration | ||||
| { | ||||
|     public static class RegisterClientConfiguration | ||||
|     { | ||||
| @@ -37,18 +37,18 @@ namespace Core.Cerberos.External.ClientConfiguration | ||||
|                 return handler; | ||||
|             }); | ||||
| 
 | ||||
|             var cerberosServiceApiUrl = GatewaySettingsConfigurations.GetCerberosServiceAPIEndpoint().Endpoint.Url; | ||||
|             var thalosServiceApiUrl = GatewaySettingsConfigurations.GetThalosServiceAPIEndpoint().Endpoint.Url; | ||||
| 
 | ||||
|             // Register ICerberosServiceClient with the manually created HttpClient | ||||
|             services.AddScoped<ICerberosServiceClient>(provider => | ||||
|             // Register IThalosServiceClient with the manually created HttpClient | ||||
|             services.AddScoped<IThalosServiceClient>(provider => | ||||
|             { | ||||
|                 var handler = provider.GetRequiredService<AuthenticatedHttpClientHandler>(); | ||||
|                 var httpClient = new HttpClient(handler) | ||||
|                 { | ||||
|                     BaseAddress = new Uri(cerberosServiceApiUrl), | ||||
|                     BaseAddress = new Uri(thalosServiceApiUrl), | ||||
|                     Timeout = TimeSpan.FromMinutes(1) | ||||
|                 }; | ||||
|                 return RestService.For<ICerberosServiceClient>(httpClient); | ||||
|                 return RestService.For<IThalosServiceClient>(httpClient); | ||||
|             }); | ||||
| 
 | ||||
|             services.AddScoped<IAuthenticationService, AuthenticationService>(); | ||||
| @@ -1,14 +1,11 @@ | ||||
| using Core.Blueprint.Storage.Adapters; | ||||
| using Core.Cerberos.Adapters; | ||||
| using Core.Cerberos.Adapters.Common.Constants; | ||||
| using Core.Cerberos.Adapters.Common.Enums; | ||||
| using Core.Cerberos.External.Clients.Requests; | ||||
| using Core.Thalos.BuildingBlocks; | ||||
| using Core.Thalos.External.Clients.Requests; | ||||
| using Microsoft.AspNetCore.Mvc; | ||||
| using Refit; | ||||
| 
 | ||||
| namespace Core.Cerberos.External.Clients | ||||
| namespace Core.Thalos.External.Clients | ||||
| { | ||||
|     public interface ICerberosServiceClient | ||||
|     public interface IThalosServiceClient | ||||
|     { | ||||
|         [Get("/v1/User")] | ||||
|         Task<IEnumerable<UserAdapter>> GetAllUsersAsync(CancellationToken cancellationToken = default); | ||||
| @@ -35,23 +32,11 @@ namespace Core.Cerberos.External.Clients | ||||
|         Task<UserAdapter> LogoutUserAsync([FromRoute] string email, CancellationToken cancellationToken = default); | ||||
| 
 | ||||
|         [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")] | ||||
|         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/Role")] | ||||
|         Task<IEnumerable<RoleAdapter>> GetAllRolesAsync(CancellationToken cancellationToken = default); | ||||
| 
 | ||||
| @@ -65,7 +50,7 @@ namespace Core.Cerberos.External.Clients | ||||
|         Task<RoleAdapter> UpdateRoleAsync([FromBody] RoleAdapter entity, [FromRoute] string id, CancellationToken cancellationToken = default); | ||||
| 
 | ||||
|         [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)] | ||||
|         Task<RoleAdapter> AddApplicationToRoleAsync([FromRoute] string RoleId, [FromRoute] ApplicationsEnum application, CancellationToken cancellationToken = default); | ||||
| @@ -89,7 +74,7 @@ namespace Core.Cerberos.External.Clients | ||||
|         Task<PermissionAdapter> UpdatePermissionAsync([FromBody] PermissionAdapter entity, [FromRoute] string id, CancellationToken cancellationToken = default); | ||||
| 
 | ||||
|         [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")] | ||||
|         Task<IEnumerable<ModuleAdapter>> GetAllModulesAsync(CancellationToken cancellationToken = default); | ||||
| @@ -107,6 +92,6 @@ namespace Core.Cerberos.External.Clients | ||||
|         Task<ModuleAdapter> UpdateModuleAsync([FromBody] ModuleAdapter entity, [FromRoute] string id, CancellationToken cancellationToken = default); | ||||
| 
 | ||||
|         [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; | ||||
| 
 | ||||
| namespace Core.Cerberos.External.Clients.Requests | ||||
| namespace Core.Thalos.External.Clients.Requests | ||||
| { | ||||
|     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 | ||||
|     { | ||||
| @@ -1,7 +1,7 @@ | ||||
| using Core.Cerberos.Adapters.Common.Enums; | ||||
| using Core.Thalos.BuildingBlocks; | ||||
| using System.Text.Json.Serialization; | ||||
| 
 | ||||
| namespace Core.Cerberos.External.Clients.Requests | ||||
| namespace Core.Thalos.External.Clients.Requests | ||||
| { | ||||
|     public class RoleRequest | ||||
|     { | ||||
| @@ -1,4 +1,4 @@ | ||||
| namespace Core.Cerberos.External.Clients.Requests | ||||
| namespace Core.Thalos.External.Clients.Requests | ||||
| { | ||||
|     public class UserRequest | ||||
|     { | ||||
| @@ -7,7 +7,5 @@ | ||||
|         public string? MiddleName { get; set; } | ||||
|         public string LastName { 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> | ||||
| 
 | ||||
|   <ItemGroup> | ||||
|     <PackageReference Include="Blueprint.Storage" Version="0.0.1" /> | ||||
|     <PackageReference Include="BuildingBlocks.Library" Version="0.0.1" /> | ||||
|     <PackageReference Include="Cerberos.Building.Blocks" Version="0.0.3" /> | ||||
|     <PackageReference Include="Core.Blueprint.Storage" Version="1.0.1" /> | ||||
|     <PackageReference Include="Core.Thalos.BuildingBlocks" Version="1.0.8" /> | ||||
|     <PackageReference Include="Lib.Architecture.BuildingBlocks" Version="1.0.0" /> | ||||
|     <PackageReference Include="Refit" Version="8.0.0" /> | ||||
|   </ItemGroup> | ||||
| 
 | ||||
| @@ -1,17 +1,17 @@ | ||||
| using Core.Blueprint.External; | ||||
| 
 | ||||
| namespace Core.Cerberos.External.GatewayConfigurations | ||||
| namespace Core.Thalos.External.GatewayConfigurations | ||||
| { | ||||
|     public record 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 BaseEndpoint Endpoint { get; set; } | ||||
| @@ -1,7 +1,7 @@ | ||||
| using Core.Blueprint.External; | ||||
| using Microsoft.Extensions.Configuration; | ||||
| 
 | ||||
| namespace Core.Cerberos.External.GatewayConfigurations | ||||
| namespace Core.Thalos.External.GatewayConfigurations | ||||
| { | ||||
|     public class GatewaySettingsConfigurations | ||||
|     { | ||||
| @@ -11,13 +11,13 @@ namespace Core.Cerberos.External.GatewayConfigurations | ||||
|         public GatewaySettingsConfigurations(IConfiguration 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; | ||||
|             var environment = Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT") ?? string.Empty; | ||||
| @@ -27,18 +27,18 @@ namespace Core.Cerberos.External.GatewayConfigurations | ||||
|             else | ||||
|                 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() | ||||
|                 { | ||||
|                     Uri = new Uri(endpoint), | ||||
|                     Url = endpoint, | ||||
|                     Token = string.Empty, | ||||
|                     APIName = "Cerberos Service" | ||||
|                     APIName = "Thalos Service" | ||||
|                 } | ||||
|             }; | ||||
| 
 | ||||
| @@ -4,7 +4,7 @@ | ||||
| // </copyright> | ||||
| // *********************************************************************** | ||||
| 
 | ||||
| namespace Core.Cerberos.External.Helpers.Token | ||||
| namespace Core.Thalos.External.Helpers.Token | ||||
| { | ||||
|     /// <summary> | ||||
|     /// Class to inject the token in all requests. | ||||
| @@ -6,7 +6,7 @@ | ||||
| 
 | ||||
| using Microsoft.AspNetCore.Http; | ||||
| 
 | ||||
| namespace Core.Cerberos.External.Helpers.Token | ||||
| namespace Core.Thalos.External.Helpers.Token | ||||
| { | ||||
|     /// <summary> | ||||
|     /// Class to return the access token to controllers. | ||||
| @@ -4,7 +4,7 @@ | ||||
| // </copyright> | ||||
| // *********************************************************************** | ||||
| 
 | ||||
| namespace Core.Cerberos.External.Helpers.Token | ||||
| namespace Core.Thalos.External.Helpers.Token | ||||
| { | ||||
|     /// <summary> | ||||
|     /// Interface for token provider. | ||||
| @@ -3,15 +3,15 @@ Microsoft Visual Studio Solution File, Format Version 12.00 | ||||
| # Visual Studio Version 17 | ||||
| VisualStudioVersion = 17.10.34928.147 | ||||
| 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 | ||||
| Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Application", "Application", "{F33D7786-EFE5-4618-9D47-C0272227C095}" | ||||
| EndProject | ||||
| Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Presentation", "Presentation", "{685F19C0-CE60-4BFB-9EDB-6834D01A6161}" | ||||
| 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 | ||||
| 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 | ||||
| Global | ||||
| 	GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||||
| @@ -1,14 +1,12 @@ | ||||
| using Asp.Versioning; | ||||
| using Core.Cerberos.Adapters; | ||||
| using Core.Cerberos.Adapters.Attributes; | ||||
| using Core.Cerberos.Adapters.Common.Constants; | ||||
| using Core.Cerberos.Application.UseCases.Modules.Input; | ||||
| using Core.Cerberos.Application.UseCases.Modules.Ports; | ||||
| using Core.Thalos.Application.UseCases.Modules.Input; | ||||
| using Core.Thalos.Application.UseCases.Modules.Ports; | ||||
| using Core.Thalos.BuildingBlocks; | ||||
| using Lib.Architecture.BuildingBlocks; | ||||
| using Microsoft.AspNetCore.Authorization; | ||||
| using Microsoft.AspNetCore.Mvc; | ||||
| 
 | ||||
| namespace Core.Cerberos.Service.API.Controllers | ||||
| namespace Core.Thalos.Service.API.Controllers | ||||
| { | ||||
|     /// <summary> | ||||
|     /// 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]")]
 | ||||
|     [Produces("application/json")] | ||||
|     [ApiController] | ||||
|     [Authorize(AuthenticationSchemes = Schemes.DefaultScheme)] | ||||
|     public class ModuleController : ControllerBase | ||||
|     { | ||||
|         private readonly IComponentHandler<GetModuleRequest> getModuleHandler; | ||||
| @@ -60,7 +59,6 @@ namespace Core.Cerberos.Service.API.Controllers | ||||
|         [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] | ||||
|         [ProducesResponseType(StatusCodes.Status500InternalServerError)] | ||||
|         [ProducesResponseType(StatusCodes.Status400BadRequest)] | ||||
|         [Authorize(AuthenticationSchemes = Schemes.HeathScheme)] | ||||
|         [Permission("ModuleManagement.Read, RoleManagement.Read")] | ||||
|         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.Status422UnprocessableEntity)] | ||||
|         [ProducesResponseType(StatusCodes.Status500InternalServerError)] | ||||
|         [Authorize(AuthenticationSchemes = Schemes.HeathScheme)] | ||||
|         [Permission("ModuleManagement.Read")] | ||||
|         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.Status422UnprocessableEntity)] | ||||
|         [ProducesResponseType(StatusCodes.Status500InternalServerError)] | ||||
|         [Authorize(AuthenticationSchemes = Schemes.HeathScheme)] | ||||
|         [Permission("ModuleManagement.Read")] | ||||
|         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(StatusCodes.Status500InternalServerError)] | ||||
|         [ProducesResponseType(StatusCodes.Status400BadRequest)] | ||||
|         [Authorize(AuthenticationSchemes = Schemes.HeathScheme)] | ||||
|         [Permission("ModuleManagement.Write")] | ||||
|         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(StatusCodes.Status500InternalServerError)] | ||||
|         [ProducesResponseType(StatusCodes.Status400BadRequest)] | ||||
|         [Authorize(AuthenticationSchemes = Schemes.HeathScheme)] | ||||
|         [Permission("ModuleManagement.Write")] | ||||
|         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.Status422UnprocessableEntity)] | ||||
|         [ProducesResponseType(StatusCodes.Status500InternalServerError)] | ||||
|         [Authorize(AuthenticationSchemes = Schemes.HeathScheme)] | ||||
|         [Permission("ModuleManagement.Write")] | ||||
|         public async Task<IActionResult> ChangeModuleStatusAsync([FromBody] ChangeModuleStatusRequest request, | ||||
|                                                                      CancellationToken cancellationToken) | ||||
| @@ -1,14 +1,12 @@ | ||||
| using Asp.Versioning; | ||||
| using Core.Cerberos.Adapters; | ||||
| using Core.Cerberos.Adapters.Attributes; | ||||
| using Core.Cerberos.Adapters.Common.Constants; | ||||
| using Core.Cerberos.Application.UseCases.Permissions.Input; | ||||
| using Core.Cerberos.Application.UseCases.Permissions.Ports; | ||||
| using Core.Thalos.Application.UseCases.Permissions.Input; | ||||
| using Core.Thalos.Application.UseCases.Permissions.Ports; | ||||
| using Core.Thalos.BuildingBlocks; | ||||
| using Lib.Architecture.BuildingBlocks; | ||||
| using Microsoft.AspNetCore.Authorization; | ||||
| using Microsoft.AspNetCore.Mvc; | ||||
| 
 | ||||
| namespace Core.Cerberos.Service.API.Controllers | ||||
| namespace Core.Thalos.Service.API.Controllers | ||||
| { | ||||
|     /// <summary> | ||||
|     /// 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]")]
 | ||||
|     [Produces("application/json")] | ||||
|     [ApiController] | ||||
|     [Authorize(AuthenticationSchemes = Schemes.DefaultScheme)] | ||||
|     public class PermissionController : ControllerBase | ||||
|     { | ||||
|         private readonly IComponentHandler<GetPermissionRequest> getPermissionHandler; | ||||
| @@ -60,7 +59,6 @@ namespace Core.Cerberos.Service.API.Controllers | ||||
|         [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] | ||||
|         [ProducesResponseType(StatusCodes.Status500InternalServerError)] | ||||
|         [ProducesResponseType(StatusCodes.Status400BadRequest)] | ||||
|         [Authorize(AuthenticationSchemes = Schemes.HeathScheme)] | ||||
|         [Permission("PermissionManagement.Read, RoleManagement.Read")] | ||||
|         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.Status422UnprocessableEntity)] | ||||
|         [ProducesResponseType(StatusCodes.Status500InternalServerError)] | ||||
|         [Authorize(AuthenticationSchemes = Schemes.HeathScheme)] | ||||
|         [Permission("PermissionManagement.Read")] | ||||
|         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.Status422UnprocessableEntity)] | ||||
|         [ProducesResponseType(StatusCodes.Status500InternalServerError)] | ||||
|         [Authorize(AuthenticationSchemes = Schemes.HeathScheme)] | ||||
|         [Permission("PermissionManagement.Read")] | ||||
|         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(StatusCodes.Status500InternalServerError)] | ||||
|         [ProducesResponseType(StatusCodes.Status400BadRequest)] | ||||
|         [Authorize(AuthenticationSchemes = Schemes.HeathScheme)] | ||||
|         [Permission("PermissionManagement.Write")] | ||||
|         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(StatusCodes.Status500InternalServerError)] | ||||
|         [ProducesResponseType(StatusCodes.Status400BadRequest)] | ||||
|         [Authorize(AuthenticationSchemes = Schemes.HeathScheme)] | ||||
|         [Permission("PermissionManagement.Write")] | ||||
|         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.Status422UnprocessableEntity)] | ||||
|         [ProducesResponseType(StatusCodes.Status500InternalServerError)] | ||||
|         [Authorize(AuthenticationSchemes = Schemes.HeathScheme)] | ||||
|         [Permission("PermissionManagement.Write")] | ||||
|         public async Task<IActionResult> ChangePermissionStatusAsync([FromBody] ChangePermissionStatusRequest request, | ||||
|                                                                      CancellationToken cancellationToken) | ||||
| @@ -1,13 +1,12 @@ | ||||
| using Asp.Versioning; | ||||
| using Core.Cerberos.Adapters.Attributes; | ||||
| using Core.Cerberos.Adapters.Common.Constants; | ||||
| using Core.Cerberos.Application.UseCases.Roles.Input; | ||||
| using Core.Cerberos.Application.UseCases.Roles.Ports; | ||||
| using Core.Thalos.Application.UseCases.Roles.Input; | ||||
| using Core.Thalos.Application.UseCases.Roles.Ports; | ||||
| using Core.Thalos.BuildingBlocks; | ||||
| using Lib.Architecture.BuildingBlocks; | ||||
| using Microsoft.AspNetCore.Authorization; | ||||
| using Microsoft.AspNetCore.Mvc; | ||||
| 
 | ||||
| namespace Core.Cerberos.Service.API.Controllers | ||||
| namespace Core.Thalos.Service.API.Controllers | ||||
| { | ||||
|     /// <summary> | ||||
|     /// Handles all requests for role authentication. | ||||
| @@ -16,7 +15,7 @@ namespace Core.Cerberos.Service.API.Controllers | ||||
|     [Route("api/v{api-version:apiVersion}/[controller]")]
 | ||||
|     [Produces("application/json")] | ||||
|     [ApiController] | ||||
|     [Authorize(AuthenticationSchemes = Schemes.HeathScheme)] | ||||
|     [Authorize(AuthenticationSchemes = Schemes.DefaultScheme)] | ||||
|     public class RoleController : ControllerBase | ||||
|     { | ||||
|         private readonly IComponentHandler<GetRoleRequest> getRoleHandler; | ||||
| @@ -63,7 +62,6 @@ namespace Core.Cerberos.Service.API.Controllers | ||||
|         [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] | ||||
|         [ProducesResponseType(StatusCodes.Status500InternalServerError)] | ||||
|         [ProducesResponseType(StatusCodes.Status400BadRequest)] | ||||
|         [Authorize(AuthenticationSchemes = Schemes.HeathScheme)] | ||||
|         [Permission("RoleManagement.Read")] | ||||
|         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.Status422UnprocessableEntity)] | ||||
|         [ProducesResponseType(StatusCodes.Status500InternalServerError)] | ||||
|         [Authorize(AuthenticationSchemes = Schemes.HeathScheme)] | ||||
|         [Permission("RoleManagement.Read")] | ||||
|         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(StatusCodes.Status500InternalServerError)] | ||||
|         [ProducesResponseType(StatusCodes.Status400BadRequest)] | ||||
|         [Authorize(AuthenticationSchemes = Schemes.HeathScheme)] | ||||
|         [Permission("RoleManagement.Write")] | ||||
|         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(StatusCodes.Status500InternalServerError)] | ||||
|         [ProducesResponseType(StatusCodes.Status400BadRequest)] | ||||
|         [Authorize(AuthenticationSchemes = Schemes.HeathScheme)] | ||||
|         [Permission("RoleManagement.Write")] | ||||
|         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.Status422UnprocessableEntity)] | ||||
|         [ProducesResponseType(StatusCodes.Status500InternalServerError)] | ||||
|         [Authorize(AuthenticationSchemes = Schemes.HeathScheme)] | ||||
|         [Permission("RoleManagement.Write")] | ||||
|         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.Status422UnprocessableEntity)] | ||||
|         [ProducesResponseType(StatusCodes.Status500InternalServerError)] | ||||
|         [Authorize(AuthenticationSchemes = Schemes.HeathScheme)] | ||||
|         [Permission("RoleManagement.Write")] | ||||
|         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.Status422UnprocessableEntity)] | ||||
|         [ProducesResponseType(StatusCodes.Status500InternalServerError)] | ||||
|         [Authorize(AuthenticationSchemes = Schemes.HeathScheme)] | ||||
|         [Permission("RoleManagement.Write")] | ||||
|         public async Task<IActionResult> RemoveApplicationToRoleAsync(RemoveApplicationFromRoleRequest request, | ||||
|                                                                    CancellationToken cancellationToken) | ||||
| @@ -1,14 +1,12 @@ | ||||
| using Asp.Versioning; | ||||
| using Core.Cerberos.Adapters; | ||||
| using Core.Cerberos.Adapters.Attributes; | ||||
| using Core.Cerberos.Adapters.Common.Constants; | ||||
| using Core.Cerberos.Application.UseCases.Users.Input; | ||||
| using Core.Cerberos.Application.UseCases.Users.Ports; | ||||
| using Core.Thalos.Application.UseCases.Users.Input; | ||||
| using Core.Thalos.Application.UseCases.Users.Ports; | ||||
| using Core.Thalos.BuildingBlocks; | ||||
| using Lib.Architecture.BuildingBlocks; | ||||
| using Microsoft.AspNetCore.Authorization; | ||||
| using Microsoft.AspNetCore.Mvc; | ||||
| 
 | ||||
| namespace Core.Cerberos.Service.API.Controllers | ||||
| namespace Core.Thalos.Service.API.Controllers | ||||
| { | ||||
|     /// <summary> | ||||
|     /// Handles all requests for user. | ||||
| @@ -25,16 +23,10 @@ namespace Core.Cerberos.Service.API.Controllers | ||||
|         private readonly IComponentHandler<CreateUserRequest> createUserHandler; | ||||
|         private readonly IComponentHandler<UpdateUserRequest> updateUserHandler; | ||||
|         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<LogoutUserRequest> logoutUserHandler; | ||||
|         private readonly IComponentHandler<ValidateUserExistenceRequest> validateUserHandler; | ||||
|         private readonly IComponentHandler<GetTokenAdapterRequest> getTokenAdapterHandler; | ||||
|         private readonly IComponentHandler<GetConsentFormPDFRequest> getConsentFormPDFHandler; | ||||
|         private readonly IComponentHandler<AcceptUserConsentFormRequest> acceptUserConsentFormHandler; | ||||
|         private readonly IUserPort port; | ||||
| 
 | ||||
|         /// <summary> | ||||
| @@ -47,16 +39,10 @@ namespace Core.Cerberos.Service.API.Controllers | ||||
|             IComponentHandler<CreateUserRequest> createUserHandler, | ||||
|             IComponentHandler<UpdateUserRequest> updateUserHandler, | ||||
|             IComponentHandler<ChangeUserStatusRequest> changeUserStatusHandler, | ||||
|             IComponentHandler<AddCompanyToUserRequest> addCompanyToUserHandler, | ||||
|             IComponentHandler<RemoveCompanyFromUserRequest> removeCompanyFromUserHandler, | ||||
|             IComponentHandler<AddProjectToUserRequest> addProjectToUserHandler, | ||||
|             IComponentHandler<RemoveProjectFromUserRequest> removeProjectFromUserHandler, | ||||
|             IComponentHandler<LoginUserRequest> loginUserHandler, | ||||
|             IComponentHandler<LogoutUserRequest> logoutUserHandler, | ||||
|             IComponentHandler<ValidateUserExistenceRequest> validateUserHandler, | ||||
|             IComponentHandler<GetTokenAdapterRequest> getTokenAdapterHandler, | ||||
|             IComponentHandler<GetConsentFormPDFRequest> getConsentFormPDFHandler, | ||||
|             IComponentHandler<AcceptUserConsentFormRequest> acceptUserConsentFormHandler, | ||||
|             IUserPort port | ||||
|             ) | ||||
|         { | ||||
| @@ -66,16 +52,10 @@ namespace Core.Cerberos.Service.API.Controllers | ||||
|             this.getAllUsersHandler = getAllUsersHandler; | ||||
|             this.getUserHandler = getUserHandler; | ||||
|             this.getUserByEmailHandler = getUserByEmailHandler; | ||||
|             this.addCompanyToUserHandler = addCompanyToUserHandler; | ||||
|             this.removeCompanyFromUserHandler = removeCompanyFromUserHandler; | ||||
|             this.addProjectToUserHandler = addProjectToUserHandler; | ||||
|             this.removeProjectFromUserHandler = removeProjectFromUserHandler; | ||||
|             this.loginUserHandler = loginUserHandler; | ||||
|             this.logoutUserHandler = logoutUserHandler; | ||||
|             this.validateUserHandler = validateUserHandler; | ||||
|             this.getTokenAdapterHandler = getTokenAdapterHandler; | ||||
|             this.getConsentFormPDFHandler = getConsentFormPDFHandler; | ||||
|             this.acceptUserConsentFormHandler = acceptUserConsentFormHandler; | ||||
|             this.port = port; | ||||
|         } | ||||
|         /// <summary> | ||||
| @@ -90,7 +70,7 @@ namespace Core.Cerberos.Service.API.Controllers | ||||
|         [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] | ||||
|         [ProducesResponseType(StatusCodes.Status500InternalServerError)] | ||||
|         [ProducesResponseType(StatusCodes.Status400BadRequest)] | ||||
|         [Authorize(AuthenticationSchemes = Schemes.HeathScheme)] | ||||
|         [Authorize(AuthenticationSchemes = Schemes.DefaultScheme)] | ||||
|         [Permission("UserManagement.Read")] | ||||
|         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.Status422UnprocessableEntity)] | ||||
|         [ProducesResponseType(StatusCodes.Status500InternalServerError)] | ||||
|         [Authorize(AuthenticationSchemes = Schemes.HeathScheme)] | ||||
|         [Authorize(AuthenticationSchemes = Schemes.DefaultScheme)] | ||||
|         [Permission("UserManagement.Read")] | ||||
|         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.Status422UnprocessableEntity)] | ||||
|         [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) | ||||
|         { | ||||
|             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(StatusCodes.Status500InternalServerError)] | ||||
|         [ProducesResponseType(StatusCodes.Status400BadRequest)] | ||||
|         [Authorize(AuthenticationSchemes = Schemes.HeathScheme)] | ||||
|         [Authorize(AuthenticationSchemes = Schemes.DefaultScheme)] | ||||
|         [Permission("UserManagement.Write")] | ||||
|         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(StatusCodes.Status500InternalServerError)] | ||||
|         [ProducesResponseType(StatusCodes.Status400BadRequest)] | ||||
|         [Authorize(AuthenticationSchemes = Schemes.HeathScheme)] | ||||
|         [Authorize(AuthenticationSchemes = Schemes.DefaultScheme)] | ||||
|         [Permission("UserManagement.Write")] | ||||
|         public async Task<IActionResult> UpdateUserAsync([FromBody] UpdateUserRequest request, | ||||
|                                                          CancellationToken cancellationToken = default) | ||||
| @@ -197,7 +177,7 @@ namespace Core.Cerberos.Service.API.Controllers | ||||
|         [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] | ||||
|         [ProducesResponseType(StatusCodes.Status400BadRequest)] | ||||
|         [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) | ||||
|         { | ||||
|             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.Status422UnprocessableEntity)] | ||||
|         [ProducesResponseType(StatusCodes.Status500InternalServerError)] | ||||
|         [Authorize(AuthenticationSchemes = Schemes.HeathScheme)] | ||||
|         [Authorize(AuthenticationSchemes = Schemes.DefaultScheme)] | ||||
|         [Permission("UserManagement.Write")] | ||||
|         public async Task<IActionResult> ChangeUserStatusAsync([FromBody] ChangeUserStatusRequest request, CancellationToken cancellationToken) | ||||
|         { | ||||
| @@ -250,107 +230,6 @@ namespace Core.Cerberos.Service.API.Controllers | ||||
|             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> | ||||
|         /// Validates if a user exists on the database. | ||||
|         /// </summary> | ||||
| @@ -379,7 +258,7 @@ namespace Core.Cerberos.Service.API.Controllers | ||||
|         [HttpPost] | ||||
|         [Route("GetTokenAdapter")] | ||||
|         [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) | ||||
|         { | ||||
|             if (string.IsNullOrEmpty(request.Email)) { return BadRequest("Invalid user email"); } | ||||
| @@ -1,4 +1,4 @@ | ||||
| <Project Sdk="Microsoft.NET.Sdk.Web"> | ||||
| <Project Sdk="Microsoft.NET.Sdk.Web"> | ||||
| 
 | ||||
|   <PropertyGroup> | ||||
|     <TargetFramework>net8.0</TargetFramework> | ||||
| @@ -8,8 +8,12 @@ | ||||
|   </PropertyGroup> | ||||
| 
 | ||||
|   <ItemGroup> | ||||
|     <ProjectReference Include="..\Core.Cerberos.Application\Core.Cerberos.Application.csproj" /> | ||||
|     <ProjectReference Include="..\Core.Cerberos.External\Core.Cerberos.External.csproj" /> | ||||
|     <PackageReference Include="Core.Blueprint.Logging" Version="1.0.1" /> | ||||
|   </ItemGroup> | ||||
| 
 | ||||
|   <ItemGroup> | ||||
|     <ProjectReference Include="..\Core.Thalos.Application\Core.Thalos.Application.csproj" /> | ||||
|     <ProjectReference Include="..\Core.Thalos.External\Core.Thalos.External.csproj" /> | ||||
|   </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" | ||||
|     } | ||||
|   }, | ||||
|   "AllowedHosts": "*", | ||||
|   "LocalGateways": { | ||||
|     "CerberosDAL": "https://localhost:7031/api" | ||||
|   } | ||||
|   "AllowedHosts": "*" | ||||
| } | ||||
| @@ -1,6 +1,6 @@ | ||||
| { | ||||
|   "Gateways": { | ||||
|     "CerberosDAL": "" // Data access layer endpoint | ||||
|     "ThalosDAL": "" // Data access layer endpoint | ||||
|   }, | ||||
|   "ConnectionStrings": { | ||||
|     "KeyVault": "" //KeyVault Uri | ||||
| @@ -17,11 +17,11 @@ | ||||
|     "CallbackPath": "", // Path for redirect after authentication | ||||
|     "Scopes": "" // Access scopes for user permissions | ||||
|   }, | ||||
|   "HeathCerberosApp": { | ||||
|   "ThalosApp": { | ||||
|     "AuthorizationUrl": "", // URL for authorization endpoint (STORED IN KEY VAULT) | ||||
|     "TokenUrl": "", // URL for token endpoint (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": { | ||||
|     "Scopes": "", // Scopes for Microsoft Graph API access | ||||
		Reference in New Issue
	
	Block a user