reeplace cerberos by thalos

This commit is contained in:
Sergio Matias Urquin
2025-05-18 19:31:25 -06:00
parent 2519e1b4fb
commit bb87b0e148
59 changed files with 194 additions and 194 deletions

View File

@@ -1,6 +0,0 @@
@Core.Cerberos.BFF.Api_HostAddress = http://localhost:5219
GET {{Core.Cerberos.BFF.Api_HostAddress}}/weatherforecast/
Accept: application/json
###

View File

@@ -1,6 +0,0 @@
namespace Core.Cerberos.External.Clients.Cerberos.Requests.Permissions
{
public class GetAllModulesRequest
{
}
}

View File

@@ -1,6 +0,0 @@
namespace Core.Cerberos.External.Clients.Cerberos.Requests.Permissions
{
public class GetAllPermissionsRequest
{
}
}

View File

@@ -1,6 +0,0 @@
namespace Core.Cerberos.Application.UseCases.Roles.Input
{
public class GetAllRolesRequest
{
}
}

View File

@@ -1,6 +0,0 @@
namespace Core.Cerberos.Application.UseCases.Users.Input
{
public class GetAllUsersRequest
{
}
}

View File

@@ -1,14 +1,14 @@
using Asp.Versioning; using Asp.Versioning;
using Core.Cerberos.Adapters; using Core.Thalos.Adapters;
using Core.Cerberos.Adapters.Common.Constants; using Core.Thalos.Adapters.Common.Constants;
using Core.Cerberos.Adapters.Contracts; using Core.Thalos.Adapters.Contracts;
using Core.Cerberos.Application.UseCases.Users.Input; using Core.Thalos.Application.UseCases.Users.Input;
using Core.Cerberos.External.Clients.Cerberos.Requests.Users; using Core.Thalos.External.Clients.Thalos.Requests.Users;
using LSA.Dashboard.External.Clients.Dashboard; using LSA.Dashboard.External.Clients.Dashboard;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
namespace Core.Cerberos.BFF.Api.Controllers namespace Core.Thalos.BFF.Api.Controllers
{ {
/// <summary> /// <summary>
/// Handles all requests for Authentication. /// Handles all requests for Authentication.
@@ -18,7 +18,7 @@ namespace Core.Cerberos.BFF.Api.Controllers
[Produces(MimeTypes.ApplicationJson)] [Produces(MimeTypes.ApplicationJson)]
[Consumes(MimeTypes.ApplicationJson)] [Consumes(MimeTypes.ApplicationJson)]
[ApiController] [ApiController]
public class AuthenticationController(ICerberosServiceClient cerberosServiceClient, ILogger<AuthenticationController> logger, ITokenService tokenService) : BaseController(logger) public class AuthenticationController(IThalosServiceClient thalosServiceClient, ILogger<AuthenticationController> logger, ITokenService tokenService) : BaseController(logger)
{ {
/// <summary> /// <summary>
/// Get token for user. /// Get token for user.
@@ -43,7 +43,7 @@ namespace Core.Cerberos.BFF.Api.Controllers
if (string.IsNullOrEmpty(email)) return BadRequest("An error ocurred while desearializing the token"); if (string.IsNullOrEmpty(email)) return BadRequest("An error ocurred while desearializing the token");
var tokenResult = await Handle(() => cerberosServiceClient.GetTokenAdapterService(new GetTokenAdapterRequest { Email = email }, cancellationToken)).ConfigureAwait(false); var tokenResult = await Handle(() => thalosServiceClient.GetTokenAdapterService(new GetTokenAdapterRequest { Email = email }, cancellationToken)).ConfigureAwait(false);
if (tokenResult is ObjectResult tokenOkResult && tokenOkResult.StatusCode == 200) if (tokenResult is ObjectResult tokenOkResult && tokenOkResult.StatusCode == 200)
tokenAdapter = tokenOkResult.Value as TokenAdapter; tokenAdapter = tokenOkResult.Value as TokenAdapter;
@@ -54,7 +54,7 @@ namespace Core.Cerberos.BFF.Api.Controllers
{ {
var (token, modules) = tokenService.GenerateAccessToken(tokenAdapter); var (token, modules) = tokenService.GenerateAccessToken(tokenAdapter);
await Handle(() => cerberosServiceClient.LoginUserService(new LoginUserRequest { Email = email }, cancellationToken)).ConfigureAwait(false); await Handle(() => thalosServiceClient.LoginUserService(new LoginUserRequest { Email = email }, cancellationToken)).ConfigureAwait(false);
return Ok(new { token, modules }); return Ok(new { token, modules });
} }
@@ -81,13 +81,13 @@ namespace Core.Cerberos.BFF.Api.Controllers
[HttpGet] [HttpGet]
[Route(Routes.RefreshToken)] [Route(Routes.RefreshToken)]
[ProducesResponseType(typeof(UserAdapter), StatusCodes.Status200OK)] [ProducesResponseType(typeof(UserAdapter), StatusCodes.Status200OK)]
[Authorize(AuthenticationSchemes = Schemes.HeathScheme)] [Authorize(AuthenticationSchemes = Schemes.DefaultScheme)]
public async Task<IActionResult> RefreshCustomTokenAsync(CancellationToken cancellationToken) public async Task<IActionResult> RefreshCustomTokenAsync(CancellationToken cancellationToken)
{ {
var tokenAdapter = new TokenAdapter(); var tokenAdapter = new TokenAdapter();
var email = tokenService.GetEmailClaim(this.HttpContext); var email = tokenService.GetEmailClaim(this.HttpContext);
var tokenResult = await Handle(() => cerberosServiceClient.GetTokenAdapterService(new GetTokenAdapterRequest { Email = email }, cancellationToken)).ConfigureAwait(false); var tokenResult = await Handle(() => thalosServiceClient.GetTokenAdapterService(new GetTokenAdapterRequest { Email = email }, cancellationToken)).ConfigureAwait(false);
if (tokenResult is ObjectResult tokenOkResult && tokenOkResult.StatusCode == 200) if (tokenResult is ObjectResult tokenOkResult && tokenOkResult.StatusCode == 200)
{ {

View File

@@ -3,7 +3,7 @@ using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json; using Newtonsoft.Json;
using Refit; using Refit;
namespace Core.Cerberos.BFF.Api.Controllers namespace Core.Thalos.BFF.Api.Controllers
{ {
[Route("api/[controller]")] [Route("api/[controller]")]
[ApiController] [ApiController]

View File

@@ -1,15 +1,15 @@
using Asp.Versioning; using Asp.Versioning;
using Core.Cerberos.Adapters; using Core.Thalos.Adapters;
using Core.Cerberos.Adapters.Attributes; using Core.Thalos.Adapters.Attributes;
using Core.Cerberos.Adapters.Common.Constants; using Core.Thalos.Adapters.Common.Constants;
using Core.Cerberos.External.Clients.Cerberos.Requests.Permissions; using Core.Thalos.External.Clients.Thalos.Requests.Permissions;
using Lib.Architecture.BuildingBlocks; using Lib.Architecture.BuildingBlocks;
using LSA.Dashboard.External.Clients.Dashboard; using LSA.Dashboard.External.Clients.Dashboard;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using System.Text.Json; using System.Text.Json;
namespace Core.Cerberos.BFF.Api.Controllers namespace Core.Thalos.BFF.Api.Controllers
{ {
/// <summary> /// <summary>
/// Handles all requests for module authentication. /// Handles all requests for module authentication.
@@ -19,8 +19,8 @@ namespace Core.Cerberos.BFF.Api.Controllers
[Consumes("application/json")] [Consumes("application/json")]
[Produces("application/json")] [Produces("application/json")]
[ApiController] [ApiController]
[Authorize(AuthenticationSchemes = Schemes.HeathScheme)] [Authorize(AuthenticationSchemes = Schemes.DefaultScheme)]
public class ModuleController(ICerberosServiceClient cerberosServiceClient, ILogger<ModuleController> logger) : BaseController(logger) public class ModuleController(IThalosServiceClient thalosServiceClient, ILogger<ModuleController> logger) : BaseController(logger)
{ {
/// <summary> /// <summary>
/// Gets all the modules. /// Gets all the modules.
@@ -39,7 +39,7 @@ namespace Core.Cerberos.BFF.Api.Controllers
{ {
logger.LogInformation($"{nameof(GetAllModulesService)} - Request received - Payload: "); logger.LogInformation($"{nameof(GetAllModulesService)} - Request received - Payload: ");
return await Handle(() => cerberosServiceClient.GetAllModulesService(new GetAllModulesRequest { }, cancellationToken)).ConfigureAwait(false); return await Handle(() => thalosServiceClient.GetAllModulesService(new GetAllModulesRequest { }, cancellationToken)).ConfigureAwait(false);
} }
catch (Exception ex) catch (Exception ex)
{ {
@@ -77,7 +77,7 @@ namespace Core.Cerberos.BFF.Api.Controllers
return BadRequest("Module identifiers are required."); return BadRequest("Module identifiers are required.");
} }
return await Handle(() => cerberosServiceClient.GetAllModulesByListService(request, cancellationToken)).ConfigureAwait(false); return await Handle(() => thalosServiceClient.GetAllModulesByListService(request, cancellationToken)).ConfigureAwait(false);
} }
catch (Exception ex) catch (Exception ex)
@@ -113,7 +113,7 @@ namespace Core.Cerberos.BFF.Api.Controllers
if (string.IsNullOrEmpty(newModule.Route)) return BadRequest("Invalid module route"); if (string.IsNullOrEmpty(newModule.Route)) return BadRequest("Invalid module route");
return await Handle(() => cerberosServiceClient.CreateModuleService(newModule, cancellationToken)).ConfigureAwait(false); return await Handle(() => thalosServiceClient.CreateModuleService(newModule, cancellationToken)).ConfigureAwait(false);
} }
catch (Exception ex) catch (Exception ex)
{ {
@@ -141,7 +141,7 @@ namespace Core.Cerberos.BFF.Api.Controllers
if (string.IsNullOrEmpty(request.Id)) return BadRequest("Invalid module identifier"); if (string.IsNullOrEmpty(request.Id)) return BadRequest("Invalid module identifier");
return await Handle(() => cerberosServiceClient.GetModuleByIdService(request, cancellationToken)).ConfigureAwait(false); return await Handle(() => thalosServiceClient.GetModuleByIdService(request, cancellationToken)).ConfigureAwait(false);
} }
catch (Exception ex) catch (Exception ex)
{ {
@@ -175,7 +175,7 @@ namespace Core.Cerberos.BFF.Api.Controllers
if (string.IsNullOrEmpty(newModule.Route)) return BadRequest("Invalid module route"); if (string.IsNullOrEmpty(newModule.Route)) return BadRequest("Invalid module route");
return await Handle(() => cerberosServiceClient.UpdateModuleService(newModule, cancellationToken)).ConfigureAwait(false); return await Handle(() => thalosServiceClient.UpdateModuleService(newModule, cancellationToken)).ConfigureAwait(false);
} }
catch (Exception ex) catch (Exception ex)
{ {
@@ -205,7 +205,7 @@ namespace Core.Cerberos.BFF.Api.Controllers
if (string.IsNullOrEmpty(request.Id)) { return BadRequest("Invalid module identifier"); } if (string.IsNullOrEmpty(request.Id)) { return BadRequest("Invalid module identifier"); }
return await Handle(() => cerberosServiceClient.ChangeModuleStatusService(request, cancellationToken)).ConfigureAwait(false); return await Handle(() => thalosServiceClient.ChangeModuleStatusService(request, cancellationToken)).ConfigureAwait(false);
} }
catch (Exception ex) catch (Exception ex)
{ {

View File

@@ -1,8 +1,8 @@
using Asp.Versioning; using Asp.Versioning;
using Core.Cerberos.Adapters; using Core.Thalos.Adapters;
using Core.Cerberos.Adapters.Attributes; using Core.Thalos.Adapters.Attributes;
using Core.Cerberos.Adapters.Common.Constants; using Core.Thalos.Adapters.Common.Constants;
using Core.Cerberos.External.Clients.Cerberos.Requests.Permissions; using Core.Thalos.External.Clients.Thalos.Requests.Permissions;
using Lib.Architecture.BuildingBlocks; using Lib.Architecture.BuildingBlocks;
using LSA.Dashboard.External.Clients.Dashboard; using LSA.Dashboard.External.Clients.Dashboard;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
@@ -10,7 +10,7 @@ using Microsoft.AspNetCore.Mvc;
using Microsoft.Graph; using Microsoft.Graph;
using System.Text.Json; using System.Text.Json;
namespace Core.Cerberos.BFF.Api.Controllers namespace Core.Thalos.BFF.Api.Controllers
{ {
/// <summary> /// <summary>
/// Handles all requests for permission authentication. /// Handles all requests for permission authentication.
@@ -20,8 +20,8 @@ namespace Core.Cerberos.BFF.Api.Controllers
[Consumes("application/json")] [Consumes("application/json")]
[Produces("application/json")] [Produces("application/json")]
[ApiController] [ApiController]
[Authorize(AuthenticationSchemes = Schemes.HeathScheme)] [Authorize(AuthenticationSchemes = Schemes.DefaultScheme)]
public class PermissionController(ICerberosServiceClient cerberosServiceClient, ILogger<PermissionController> logger) : BaseController(logger) public class PermissionController(IThalosServiceClient thalosServiceClient, ILogger<PermissionController> logger) : BaseController(logger)
{ {
/// <summary> /// <summary>
/// Gets all the permissions. /// Gets all the permissions.
@@ -40,7 +40,7 @@ namespace Core.Cerberos.BFF.Api.Controllers
{ {
logger.LogInformation($"{nameof(GetAllPermissionsService)} - Request received - Payload: "); logger.LogInformation($"{nameof(GetAllPermissionsService)} - Request received - Payload: ");
return await Handle(() => cerberosServiceClient.GetAllPermissionsService(new GetAllPermissionsRequest { }, cancellationToken)).ConfigureAwait(false); return await Handle(() => thalosServiceClient.GetAllPermissionsService(new GetAllPermissionsRequest { }, cancellationToken)).ConfigureAwait(false);
} }
catch (Exception ex) catch (Exception ex)
{ {
@@ -78,7 +78,7 @@ namespace Core.Cerberos.BFF.Api.Controllers
return BadRequest("Permission identifiers are required."); return BadRequest("Permission identifiers are required.");
} }
return await Handle(() => cerberosServiceClient.GetAllPermissionsByListService(request, cancellationToken)).ConfigureAwait(false); return await Handle(() => thalosServiceClient.GetAllPermissionsByListService(request, cancellationToken)).ConfigureAwait(false);
} }
catch (Exception ex) catch (Exception ex)
@@ -112,7 +112,7 @@ namespace Core.Cerberos.BFF.Api.Controllers
if (string.IsNullOrEmpty(newPermission.Description)) return BadRequest("Invalid permission description"); if (string.IsNullOrEmpty(newPermission.Description)) return BadRequest("Invalid permission description");
return await Handle(() => cerberosServiceClient.CreatePermissionService(newPermission, cancellationToken)).ConfigureAwait(false); return await Handle(() => thalosServiceClient.CreatePermissionService(newPermission, cancellationToken)).ConfigureAwait(false);
} }
catch (Exception ex) catch (Exception ex)
{ {
@@ -140,7 +140,7 @@ namespace Core.Cerberos.BFF.Api.Controllers
if (string.IsNullOrEmpty(request.Id)) return BadRequest("Invalid permission identifier"); if (string.IsNullOrEmpty(request.Id)) return BadRequest("Invalid permission identifier");
return await Handle(() => cerberosServiceClient.GetPermissionByIdService(request, cancellationToken)).ConfigureAwait(false); return await Handle(() => thalosServiceClient.GetPermissionByIdService(request, cancellationToken)).ConfigureAwait(false);
} }
catch (Exception ex) catch (Exception ex)
{ {
@@ -172,7 +172,7 @@ namespace Core.Cerberos.BFF.Api.Controllers
if (string.IsNullOrEmpty(newPermission.Description)) return BadRequest("Invalid permission description"); if (string.IsNullOrEmpty(newPermission.Description)) return BadRequest("Invalid permission description");
return await Handle(() => cerberosServiceClient.UpdatePermissionService(newPermission, cancellationToken)).ConfigureAwait(false); return await Handle(() => thalosServiceClient.UpdatePermissionService(newPermission, cancellationToken)).ConfigureAwait(false);
} }
catch (Exception ex) catch (Exception ex)
{ {
@@ -202,7 +202,7 @@ namespace Core.Cerberos.BFF.Api.Controllers
if (string.IsNullOrEmpty(request.Id)) { return BadRequest("Invalid permission identifier"); } if (string.IsNullOrEmpty(request.Id)) { return BadRequest("Invalid permission identifier"); }
return await Handle(() => cerberosServiceClient.ChangePermissionStatusService(request, cancellationToken)).ConfigureAwait(false); return await Handle(() => thalosServiceClient.ChangePermissionStatusService(request, cancellationToken)).ConfigureAwait(false);
} }
catch (Exception ex) catch (Exception ex)
{ {

View File

@@ -1,14 +1,14 @@
using Asp.Versioning; using Asp.Versioning;
using Core.Cerberos.Adapters.Attributes; using Core.Thalos.Adapters.Attributes;
using Core.Cerberos.Adapters.Common.Constants; using Core.Thalos.Adapters.Common.Constants;
using Core.Cerberos.Application.UseCases.Roles.Input; using Core.Thalos.Application.UseCases.Roles.Input;
using Lib.Architecture.BuildingBlocks; using Lib.Architecture.BuildingBlocks;
using LSA.Dashboard.External.Clients.Dashboard; using LSA.Dashboard.External.Clients.Dashboard;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using System.Text.Json; using System.Text.Json;
namespace Core.Cerberos.BFF.Api.Controllers namespace Core.Thalos.BFF.Api.Controllers
{ {
/// <summary> /// <summary>
/// Handles all requests for role authentication. /// Handles all requests for role authentication.
@@ -18,8 +18,8 @@ namespace Core.Cerberos.BFF.Api.Controllers
[Consumes("application/json")] [Consumes("application/json")]
[Produces("application/json")] [Produces("application/json")]
[ApiController] [ApiController]
[Authorize(AuthenticationSchemes = Schemes.HeathScheme)] [Authorize(AuthenticationSchemes = Schemes.DefaultScheme)]
public class RoleController(ICerberosServiceClient cerberosServiceClient, ILogger<RoleController> logger) : BaseController(logger) public class RoleController(IThalosServiceClient thalosServiceClient, ILogger<RoleController> logger) : BaseController(logger)
{ {
/// <summary> /// <summary>
/// Gets all the roles. /// Gets all the roles.
@@ -38,7 +38,7 @@ namespace Core.Cerberos.BFF.Api.Controllers
{ {
logger.LogInformation($"{nameof(GetAllRolesService)} - Request received - Payload: "); logger.LogInformation($"{nameof(GetAllRolesService)} - Request received - Payload: ");
return await Handle(() => cerberosServiceClient.GetAllRolesService(new GetAllRolesRequest { }, cancellationToken)).ConfigureAwait(false); return await Handle(() => thalosServiceClient.GetAllRolesService(new GetAllRolesRequest { }, cancellationToken)).ConfigureAwait(false);
} }
catch (Exception ex) catch (Exception ex)
{ {
@@ -76,7 +76,7 @@ namespace Core.Cerberos.BFF.Api.Controllers
if (request.Permissions?.Length <= 0) return BadRequest("Role must have at least one permission"); if (request.Permissions?.Length <= 0) return BadRequest("Role must have at least one permission");
return await Handle(() => cerberosServiceClient.CreateRoleService(request, cancellationToken)).ConfigureAwait(false); return await Handle(() => thalosServiceClient.CreateRoleService(request, cancellationToken)).ConfigureAwait(false);
} }
catch (Exception ex) catch (Exception ex)
{ {
@@ -104,7 +104,7 @@ namespace Core.Cerberos.BFF.Api.Controllers
if (string.IsNullOrEmpty(request.Id)) return BadRequest("Invalid role identifier"); if (string.IsNullOrEmpty(request.Id)) return BadRequest("Invalid role identifier");
return await Handle(() => cerberosServiceClient.GetRoleByIdService(request, cancellationToken)).ConfigureAwait(false); return await Handle(() => thalosServiceClient.GetRoleByIdService(request, cancellationToken)).ConfigureAwait(false);
} }
catch (Exception ex) catch (Exception ex)
{ {
@@ -145,7 +145,7 @@ namespace Core.Cerberos.BFF.Api.Controllers
if (request.Permissions?.Length <= 0) return BadRequest("Role must have at least one permission"); if (request.Permissions?.Length <= 0) return BadRequest("Role must have at least one permission");
return await Handle(() => cerberosServiceClient.UpdateRoleService(request, cancellationToken)).ConfigureAwait(false); return await Handle(() => thalosServiceClient.UpdateRoleService(request, cancellationToken)).ConfigureAwait(false);
} }
catch (Exception ex) catch (Exception ex)
{ {
@@ -175,7 +175,7 @@ namespace Core.Cerberos.BFF.Api.Controllers
if (string.IsNullOrEmpty(request.Id)) { return BadRequest("Invalid role identifier"); } if (string.IsNullOrEmpty(request.Id)) { return BadRequest("Invalid role identifier"); }
return await Handle(() => cerberosServiceClient.ChangeRoleStatusService(request, cancellationToken)).ConfigureAwait(false); return await Handle(() => thalosServiceClient.ChangeRoleStatusService(request, cancellationToken)).ConfigureAwait(false);
} }
catch (Exception ex) catch (Exception ex)
{ {
@@ -205,7 +205,7 @@ namespace Core.Cerberos.BFF.Api.Controllers
if (string.IsNullOrEmpty(request.RoleId)) { return BadRequest("Invalid role identifier"); } if (string.IsNullOrEmpty(request.RoleId)) { return BadRequest("Invalid role identifier"); }
return await Handle(() => cerberosServiceClient.AddApplicationToRoleService(request, cancellationToken)).ConfigureAwait(false); return await Handle(() => thalosServiceClient.AddApplicationToRoleService(request, cancellationToken)).ConfigureAwait(false);
} }
catch (Exception ex) catch (Exception ex)
{ {
@@ -235,7 +235,7 @@ namespace Core.Cerberos.BFF.Api.Controllers
if (string.IsNullOrEmpty(request.RoleId)) { return BadRequest("Invalid role identifier"); } if (string.IsNullOrEmpty(request.RoleId)) { return BadRequest("Invalid role identifier"); }
return await Handle(() => cerberosServiceClient.RemoveApplicationFromRoleService(request, cancellationToken)).ConfigureAwait(false); return await Handle(() => thalosServiceClient.RemoveApplicationFromRoleService(request, cancellationToken)).ConfigureAwait(false);
} }
catch (Exception ex) catch (Exception ex)
{ {

View File

@@ -1,15 +1,15 @@
using Asp.Versioning; using Asp.Versioning;
using Core.Cerberos.Adapters.Attributes; using Core.Thalos.Adapters.Attributes;
using Core.Cerberos.Adapters.Common.Constants; using Core.Thalos.Adapters.Common.Constants;
using Core.Cerberos.Application.UseCases.Users.Input; using Core.Thalos.Application.UseCases.Users.Input;
using Core.Cerberos.External.Clients.Cerberos.Requests.Users; using Core.Thalos.External.Clients.Thalos.Requests.Users;
using Lib.Architecture.BuildingBlocks; using Lib.Architecture.BuildingBlocks;
using LSA.Dashboard.External.Clients.Dashboard; using LSA.Dashboard.External.Clients.Dashboard;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using System.Text.Json; using System.Text.Json;
namespace Core.Cerberos.BFF.Api.Controllers namespace Core.Thalos.BFF.Api.Controllers
{ {
/// <summary> /// <summary>
/// Handles all requests for user authentication. /// Handles all requests for user authentication.
@@ -19,7 +19,7 @@ namespace Core.Cerberos.BFF.Api.Controllers
[Consumes("application/json")] [Consumes("application/json")]
[Produces("application/json")] [Produces("application/json")]
[ApiController] [ApiController]
public class UserController(ICerberosServiceClient cerberosServiceClient, ILogger<UserController> logger) : BaseController(logger) public class UserController(IThalosServiceClient thalosServiceClient, ILogger<UserController> logger) : BaseController(logger)
{ {
/// <summary> /// <summary>
/// Gets all the users. /// Gets all the users.
@@ -31,7 +31,7 @@ namespace Core.Cerberos.BFF.Api.Controllers
[ProducesResponseType(typeof(Notification), StatusCodes.Status412PreconditionFailed)] [ProducesResponseType(typeof(Notification), StatusCodes.Status412PreconditionFailed)]
[ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)] [ProducesResponseType(StatusCodes.Status500InternalServerError)]
[Authorize(AuthenticationSchemes = Schemes.HeathScheme)] [Authorize(AuthenticationSchemes = Schemes.DefaultScheme)]
[Permission("UserManagement.Read")] [Permission("UserManagement.Read")]
public async Task<IActionResult> GetAllUsersService(CancellationToken cancellationToken) public async Task<IActionResult> GetAllUsersService(CancellationToken cancellationToken)
{ {
@@ -39,7 +39,7 @@ namespace Core.Cerberos.BFF.Api.Controllers
{ {
logger.LogInformation($"{nameof(GetAllUsersService)} - Request received - Payload: "); logger.LogInformation($"{nameof(GetAllUsersService)} - Request received - Payload: ");
return await Handle(() => cerberosServiceClient.GetAllUsersService(new GetAllUsersRequest { }, cancellationToken)).ConfigureAwait(false); return await Handle(() => thalosServiceClient.GetAllUsersService(new GetAllUsersRequest { }, cancellationToken)).ConfigureAwait(false);
} }
catch (Exception ex) catch (Exception ex)
{ {
@@ -58,7 +58,7 @@ namespace Core.Cerberos.BFF.Api.Controllers
[ProducesResponseType(typeof(Notification), StatusCodes.Status412PreconditionFailed)] [ProducesResponseType(typeof(Notification), StatusCodes.Status412PreconditionFailed)]
[ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)] [ProducesResponseType(StatusCodes.Status500InternalServerError)]
[Authorize(AuthenticationSchemes = Schemes.HeathScheme)] [Authorize(AuthenticationSchemes = Schemes.DefaultScheme)]
[Permission("UserManagement.Write")] [Permission("UserManagement.Write")]
public async Task<IActionResult> CreateUserService(CreateUserRequest newUser, CancellationToken cancellationToken) public async Task<IActionResult> CreateUserService(CreateUserRequest newUser, CancellationToken cancellationToken)
{ {
@@ -78,7 +78,7 @@ namespace Core.Cerberos.BFF.Api.Controllers
if (!newUser.Companies.Any()) return BadRequest("The user must contain at least one company"); if (!newUser.Companies.Any()) return BadRequest("The user must contain at least one company");
return await Handle(() => cerberosServiceClient.CreateUserService(newUser, cancellationToken)).ConfigureAwait(false); return await Handle(() => thalosServiceClient.CreateUserService(newUser, cancellationToken)).ConfigureAwait(false);
} }
catch (Exception ex) catch (Exception ex)
{ {
@@ -97,7 +97,7 @@ namespace Core.Cerberos.BFF.Api.Controllers
[ProducesResponseType(typeof(Notification), StatusCodes.Status412PreconditionFailed)] [ProducesResponseType(typeof(Notification), StatusCodes.Status412PreconditionFailed)]
[ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)] [ProducesResponseType(StatusCodes.Status500InternalServerError)]
[Authorize(AuthenticationSchemes = Schemes.HeathScheme)] [Authorize(AuthenticationSchemes = Schemes.DefaultScheme)]
[Permission("UserManagement.Read")] [Permission("UserManagement.Read")]
public async Task<IActionResult> GetUserByIdService(GetUserRequest request, CancellationToken cancellationToken) public async Task<IActionResult> GetUserByIdService(GetUserRequest request, CancellationToken cancellationToken)
{ {
@@ -107,7 +107,7 @@ namespace Core.Cerberos.BFF.Api.Controllers
if (string.IsNullOrEmpty(request.Id)) return BadRequest("Invalid user identifier"); if (string.IsNullOrEmpty(request.Id)) return BadRequest("Invalid user identifier");
return await Handle(() => cerberosServiceClient.GetUserByIdService(request, cancellationToken)).ConfigureAwait(false); return await Handle(() => thalosServiceClient.GetUserByIdService(request, cancellationToken)).ConfigureAwait(false);
} }
catch (Exception ex) catch (Exception ex)
{ {
@@ -126,7 +126,7 @@ namespace Core.Cerberos.BFF.Api.Controllers
[ProducesResponseType(typeof(Notification), StatusCodes.Status412PreconditionFailed)] [ProducesResponseType(typeof(Notification), StatusCodes.Status412PreconditionFailed)]
[ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)] [ProducesResponseType(StatusCodes.Status500InternalServerError)]
[Authorize(AuthenticationSchemes = Schemes.HeathScheme)] [Authorize(AuthenticationSchemes = Schemes.DefaultScheme)]
[Permission("UserManagement.Read")] [Permission("UserManagement.Read")]
public async Task<IActionResult> GetUserByEmailService(GetUserByEmailRequest request, CancellationToken cancellationToken) public async Task<IActionResult> GetUserByEmailService(GetUserByEmailRequest request, CancellationToken cancellationToken)
{ {
@@ -136,7 +136,7 @@ namespace Core.Cerberos.BFF.Api.Controllers
if (string.IsNullOrEmpty(request.Email)) return BadRequest("Invalid user email"); if (string.IsNullOrEmpty(request.Email)) return BadRequest("Invalid user email");
return await Handle(() => cerberosServiceClient.GetUserByEmailService(request, cancellationToken)).ConfigureAwait(false); return await Handle(() => thalosServiceClient.GetUserByEmailService(request, cancellationToken)).ConfigureAwait(false);
} }
catch (Exception ex) catch (Exception ex)
{ {
@@ -155,7 +155,7 @@ namespace Core.Cerberos.BFF.Api.Controllers
[ProducesResponseType(typeof(Notification), StatusCodes.Status412PreconditionFailed)] [ProducesResponseType(typeof(Notification), StatusCodes.Status412PreconditionFailed)]
[ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)] [ProducesResponseType(StatusCodes.Status500InternalServerError)]
[Authorize(AuthenticationSchemes = Schemes.HeathScheme)] [Authorize(AuthenticationSchemes = Schemes.DefaultScheme)]
[Permission("UserManagement.Write")] [Permission("UserManagement.Write")]
public async Task<IActionResult> UpdateUserService(UpdateUserRequest request, CancellationToken cancellationToken) public async Task<IActionResult> UpdateUserService(UpdateUserRequest request, CancellationToken cancellationToken)
{ {
@@ -175,7 +175,7 @@ namespace Core.Cerberos.BFF.Api.Controllers
if (!request.Companies.Any()) return BadRequest("The user must contain at least one company"); if (!request.Companies.Any()) return BadRequest("The user must contain at least one company");
return await Handle(() => cerberosServiceClient.UpdateUserService(request, cancellationToken)).ConfigureAwait(false); return await Handle(() => thalosServiceClient.UpdateUserService(request, cancellationToken)).ConfigureAwait(false);
} }
catch (Exception ex) catch (Exception ex)
{ {
@@ -194,7 +194,7 @@ namespace Core.Cerberos.BFF.Api.Controllers
[ProducesResponseType(typeof(Notification), StatusCodes.Status412PreconditionFailed)] [ProducesResponseType(typeof(Notification), StatusCodes.Status412PreconditionFailed)]
[ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)] [ProducesResponseType(StatusCodes.Status500InternalServerError)]
[Authorize(AuthenticationSchemes = $"{Schemes.AzureScheme}, {Schemes.HeathScheme}")] [Authorize(AuthenticationSchemes = $"{Schemes.AzureScheme}, {Schemes.DefaultScheme}")]
public async Task<IActionResult> LoginUserService([FromBody] LoginUserRequest request, CancellationToken cancellationToken) public async Task<IActionResult> LoginUserService([FromBody] LoginUserRequest request, CancellationToken cancellationToken)
{ {
try try
@@ -203,7 +203,7 @@ namespace Core.Cerberos.BFF.Api.Controllers
if (string.IsNullOrEmpty(request.Email)) return BadRequest("Invalid user email"); if (string.IsNullOrEmpty(request.Email)) return BadRequest("Invalid user email");
return await Handle(() => cerberosServiceClient.LoginUserService(request, cancellationToken)).ConfigureAwait(false); return await Handle(() => thalosServiceClient.LoginUserService(request, cancellationToken)).ConfigureAwait(false);
} }
catch (Exception ex) catch (Exception ex)
{ {
@@ -222,7 +222,7 @@ namespace Core.Cerberos.BFF.Api.Controllers
[ProducesResponseType(typeof(Notification), StatusCodes.Status412PreconditionFailed)] [ProducesResponseType(typeof(Notification), StatusCodes.Status412PreconditionFailed)]
[ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)] [ProducesResponseType(StatusCodes.Status500InternalServerError)]
[Authorize(AuthenticationSchemes = $"{Schemes.AzureScheme}, {Schemes.HeathScheme}")] [Authorize(AuthenticationSchemes = $"{Schemes.AzureScheme}, {Schemes.DefaultScheme}")]
public async Task<IActionResult> LogoutUserService([FromBody] LogoutUserRequest request, CancellationToken cancellationToken) public async Task<IActionResult> LogoutUserService([FromBody] LogoutUserRequest request, CancellationToken cancellationToken)
{ {
try try
@@ -231,7 +231,7 @@ namespace Core.Cerberos.BFF.Api.Controllers
if (string.IsNullOrEmpty(request.Email)) return BadRequest("Invalid user email"); if (string.IsNullOrEmpty(request.Email)) return BadRequest("Invalid user email");
return await Handle(() => cerberosServiceClient.LogoutUserService(request, cancellationToken)).ConfigureAwait(false); return await Handle(() => thalosServiceClient.LogoutUserService(request, cancellationToken)).ConfigureAwait(false);
} }
catch (Exception ex) catch (Exception ex)
{ {
@@ -252,7 +252,7 @@ namespace Core.Cerberos.BFF.Api.Controllers
[ProducesResponseType(typeof(Notification), StatusCodes.Status412PreconditionFailed)] [ProducesResponseType(typeof(Notification), StatusCodes.Status412PreconditionFailed)]
[ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)] [ProducesResponseType(StatusCodes.Status500InternalServerError)]
[Authorize(AuthenticationSchemes = Schemes.HeathScheme)] [Authorize(AuthenticationSchemes = Schemes.DefaultScheme)]
[Permission("UserManagement.Write")] [Permission("UserManagement.Write")]
public async Task<IActionResult> ChangeUserStatusService([FromBody] ChangeUserStatusRequest request, CancellationToken cancellationToken) public async Task<IActionResult> ChangeUserStatusService([FromBody] ChangeUserStatusRequest request, CancellationToken cancellationToken)
{ {
@@ -262,7 +262,7 @@ namespace Core.Cerberos.BFF.Api.Controllers
if (string.IsNullOrEmpty(request.Id)) { return BadRequest("Invalid user identifier"); } if (string.IsNullOrEmpty(request.Id)) { return BadRequest("Invalid user identifier"); }
return await Handle(() => cerberosServiceClient.ChangeUserStatusService(request, cancellationToken)).ConfigureAwait(false); return await Handle(() => thalosServiceClient.ChangeUserStatusService(request, cancellationToken)).ConfigureAwait(false);
} }
catch (Exception ex) catch (Exception ex)
{ {
@@ -283,7 +283,7 @@ namespace Core.Cerberos.BFF.Api.Controllers
[ProducesResponseType(typeof(Notification), StatusCodes.Status412PreconditionFailed)] [ProducesResponseType(typeof(Notification), StatusCodes.Status412PreconditionFailed)]
[ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)] [ProducesResponseType(StatusCodes.Status500InternalServerError)]
[Authorize(AuthenticationSchemes = Schemes.HeathScheme)] [Authorize(AuthenticationSchemes = Schemes.DefaultScheme)]
[Permission("UserManagement.Write")] [Permission("UserManagement.Write")]
public async Task<IActionResult> AddCompanyToUserService([FromBody] AddCompanyToUserRequest request, CancellationToken cancellationToken) public async Task<IActionResult> AddCompanyToUserService([FromBody] AddCompanyToUserRequest request, CancellationToken cancellationToken)
{ {
@@ -294,7 +294,7 @@ namespace Core.Cerberos.BFF.Api.Controllers
if (string.IsNullOrEmpty(request.UserId)) { return BadRequest("Invalid user identifier"); } if (string.IsNullOrEmpty(request.UserId)) { return BadRequest("Invalid user identifier"); }
if (string.IsNullOrEmpty(request.CompanyId)) { return BadRequest("Invalid company identifier"); } if (string.IsNullOrEmpty(request.CompanyId)) { return BadRequest("Invalid company identifier"); }
return await Handle(() => cerberosServiceClient.AddCompanyToUserService(request, cancellationToken)).ConfigureAwait(false); return await Handle(() => thalosServiceClient.AddCompanyToUserService(request, cancellationToken)).ConfigureAwait(false);
} }
catch (Exception ex) catch (Exception ex)
{ {
@@ -315,7 +315,7 @@ namespace Core.Cerberos.BFF.Api.Controllers
[ProducesResponseType(typeof(Notification), StatusCodes.Status412PreconditionFailed)] [ProducesResponseType(typeof(Notification), StatusCodes.Status412PreconditionFailed)]
[ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)] [ProducesResponseType(StatusCodes.Status500InternalServerError)]
[Authorize(AuthenticationSchemes = Schemes.HeathScheme)] [Authorize(AuthenticationSchemes = Schemes.DefaultScheme)]
[Permission("UserManagement.Write")] [Permission("UserManagement.Write")]
public async Task<IActionResult> RemoveCompanyFromUserService([FromBody] RemoveCompanyFromUserRequest request, CancellationToken cancellationToken) public async Task<IActionResult> RemoveCompanyFromUserService([FromBody] RemoveCompanyFromUserRequest request, CancellationToken cancellationToken)
{ {
@@ -326,7 +326,7 @@ namespace Core.Cerberos.BFF.Api.Controllers
if (string.IsNullOrEmpty(request.UserId)) { return BadRequest("Invalid user identifier"); } if (string.IsNullOrEmpty(request.UserId)) { return BadRequest("Invalid user identifier"); }
if (string.IsNullOrEmpty(request.CompanyId)) { return BadRequest("Invalid company identifier"); } if (string.IsNullOrEmpty(request.CompanyId)) { return BadRequest("Invalid company identifier"); }
return await Handle(() => cerberosServiceClient.RemoveCompanyFromUserService(request, cancellationToken)).ConfigureAwait(false); return await Handle(() => thalosServiceClient.RemoveCompanyFromUserService(request, cancellationToken)).ConfigureAwait(false);
} }
catch (Exception ex) catch (Exception ex)
{ {
@@ -347,7 +347,7 @@ namespace Core.Cerberos.BFF.Api.Controllers
[ProducesResponseType(typeof(Notification), StatusCodes.Status412PreconditionFailed)] [ProducesResponseType(typeof(Notification), StatusCodes.Status412PreconditionFailed)]
[ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)] [ProducesResponseType(StatusCodes.Status500InternalServerError)]
[Authorize(AuthenticationSchemes = Schemes.HeathScheme)] [Authorize(AuthenticationSchemes = Schemes.DefaultScheme)]
[Permission("UserManagement.Write")] [Permission("UserManagement.Write")]
public async Task<IActionResult> AddProjectToUserService([FromBody] AddProjectToUserRequest request, CancellationToken cancellationToken) public async Task<IActionResult> AddProjectToUserService([FromBody] AddProjectToUserRequest request, CancellationToken cancellationToken)
@@ -359,7 +359,7 @@ namespace Core.Cerberos.BFF.Api.Controllers
if (string.IsNullOrEmpty(request.UserId)) { return BadRequest("Invalid user identifier"); } if (string.IsNullOrEmpty(request.UserId)) { return BadRequest("Invalid user identifier"); }
if (string.IsNullOrEmpty(request.ProjectId)) { return BadRequest("Invalid project identifier"); } if (string.IsNullOrEmpty(request.ProjectId)) { return BadRequest("Invalid project identifier"); }
return await Handle(() => cerberosServiceClient.AddProjectToUserService(request, cancellationToken)).ConfigureAwait(false); return await Handle(() => thalosServiceClient.AddProjectToUserService(request, cancellationToken)).ConfigureAwait(false);
} }
catch (Exception ex) catch (Exception ex)
{ {
@@ -380,7 +380,7 @@ namespace Core.Cerberos.BFF.Api.Controllers
[ProducesResponseType(typeof(Notification), StatusCodes.Status412PreconditionFailed)] [ProducesResponseType(typeof(Notification), StatusCodes.Status412PreconditionFailed)]
[ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)] [ProducesResponseType(StatusCodes.Status500InternalServerError)]
[Authorize(AuthenticationSchemes = Schemes.HeathScheme)] [Authorize(AuthenticationSchemes = Schemes.DefaultScheme)]
[Permission("UserManagement.Write")] [Permission("UserManagement.Write")]
public async Task<IActionResult> RemoveProjectFromUserService([FromBody] RemoveProjectFromUserRequest request, CancellationToken cancellationToken) public async Task<IActionResult> RemoveProjectFromUserService([FromBody] RemoveProjectFromUserRequest request, CancellationToken cancellationToken)
{ {
@@ -391,7 +391,7 @@ namespace Core.Cerberos.BFF.Api.Controllers
if (string.IsNullOrEmpty(request.UserId)) { return BadRequest("Invalid user identifier"); } if (string.IsNullOrEmpty(request.UserId)) { return BadRequest("Invalid user identifier"); }
if (string.IsNullOrEmpty(request.ProjectId)) { return BadRequest("Invalid project identifier"); } if (string.IsNullOrEmpty(request.ProjectId)) { return BadRequest("Invalid project identifier"); }
return await Handle(() => cerberosServiceClient.RemoveProjectFromUserService(request, cancellationToken)).ConfigureAwait(false); return await Handle(() => thalosServiceClient.RemoveProjectFromUserService(request, cancellationToken)).ConfigureAwait(false);
} }
catch (Exception ex) catch (Exception ex)
{ {
@@ -419,7 +419,7 @@ namespace Core.Cerberos.BFF.Api.Controllers
if (string.IsNullOrEmpty(request.Email)) return BadRequest("Invalid user email"); if (string.IsNullOrEmpty(request.Email)) return BadRequest("Invalid user email");
return await Handle(() => cerberosServiceClient.ValidateUserExistenceService(request, cancellationToken)).ConfigureAwait(false); return await Handle(() => thalosServiceClient.ValidateUserExistenceService(request, cancellationToken)).ConfigureAwait(false);
} }
catch (Exception ex) catch (Exception ex)
{ {

View File

@@ -8,7 +8,7 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\Core.Cerberos.External\Core.Cerberos.External.csproj" /> <ProjectReference Include="..\Core.Thalos.External\Core.Thalos.External.csproj" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View File

@@ -0,0 +1,6 @@
@Core.Thalos.BFF.Api_HostAddress = http://localhost:5219
GET {{Core.Thalos.BFF.Api_HostAddress}}/weatherforecast/
Accept: application/json
###

View File

@@ -1,6 +1,6 @@
using Core.Cerberos.Adapters.Extensions; using Core.Thalos.Adapters.Extensions;
using Core.Cerberos.Adapters.Helpers; using Core.Thalos.Adapters.Helpers;
using Core.Cerberos.External.ClientConfiguration; using Core.Thalos.External.ClientConfiguration;
using Microsoft.AspNetCore.ResponseCompression; using Microsoft.AspNetCore.ResponseCompression;
using OpenTelemetry.Logs; using OpenTelemetry.Logs;
using OpenTelemetry.Resources; using OpenTelemetry.Resources;
@@ -9,7 +9,7 @@ using System.Reflection;
var builder = WebApplication.CreateBuilder(args); var builder = WebApplication.CreateBuilder(args);
var authSettings = AuthHelper.GetAuthSettings(builder, "cerberos_bff"); var authSettings = AuthHelper.GetAuthSettings(builder, "thalos_bff");
builder.Services.ConfigureAuthentication(builder.Configuration, authSettings); builder.Services.ConfigureAuthentication(builder.Configuration, authSettings);
@@ -25,7 +25,7 @@ builder.Services.AddResponseCaching(configureOptions => { configureOptions.UseCa
builder.Logging.AddOpenTelemetry(options => builder.Logging.AddOpenTelemetry(options =>
{ {
options.IncludeScopes = true; options.IncludeScopes = true;
options.SetResourceBuilder(ResourceBuilder.CreateDefault().AddService("core.cerberos.bff.api")).AddConsoleExporter(); options.SetResourceBuilder(ResourceBuilder.CreateDefault().AddService("core.thalos.bff.api")).AddConsoleExporter();
}); });
builder.Host.ConfigureServices((context, services) => builder.Host.ConfigureServices((context, services) =>
@@ -81,7 +81,7 @@ builder.Host.ConfigureServices((context, services) =>
services.AddControllers(); services.AddControllers();
services.AddEndpointsApiExplorer(); services.AddEndpointsApiExplorer();
services.AddVersioning(builder.Configuration); services.AddVersioning(builder.Configuration);
services.AddSwagger(builder.Configuration, "Core.Cerberos.BFF.API.xml", authSettings); services.AddSwagger(builder.Configuration, "Core.Thalos.BFF.API.xml", authSettings);
services.AddLogging(); services.AddLogging();
services.AddProblemDetails(); services.AddProblemDetails();
services.AddHttpContextAccessor(); services.AddHttpContextAccessor();

View File

@@ -6,7 +6,7 @@
} }
}, },
"LocalGateways": { "LocalGateways": {
"CerberosService": "https://localhost:7253/api" "ThalosService": "https://localhost:7253/api"
} }
} }

View File

@@ -1,6 +1,6 @@
{ {
"Gateways": { "Gateways": {
"CerberosService": "" // Service endpoint for Cerberos "ThalosService": "" // Service endpoint for Thalos
}, },
"ConnectionStrings": { "ConnectionStrings": {
"KeyVault": "" //KeyVault Uri "KeyVault": "" //KeyVault Uri
@@ -17,7 +17,7 @@
"CallbackPath": "", // Path for redirect after authentication "CallbackPath": "", // Path for redirect after authentication
"Scopes": "" // Access scopes for user permissions "Scopes": "" // Access scopes for user permissions
}, },
"HeathCerberosApp": { "ThalosApp": {
"AuthorizationUrl": "", // URL for authorization endpoint(STORED IN KEY VAULT) "AuthorizationUrl": "", // URL for authorization endpoint(STORED IN KEY VAULT)
"TokenUrl": "", // URL for token endpoint(STORED IN KEY VAULT) "TokenUrl": "", // URL for token endpoint(STORED IN KEY VAULT)
"Scope": "", // Scope for application permissions (STORED IN KEY VAULT) "Scope": "", // Scope for application permissions (STORED IN KEY VAULT)

View File

@@ -3,9 +3,9 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17 # Visual Studio Version 17
VisualStudioVersion = 17.10.35027.167 VisualStudioVersion = 17.10.35027.167
MinimumVisualStudioVersion = 10.0.40219.1 MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Core.Cerberos.BFF.Api", "Core.Cerberos.BFF.Api\Core.Cerberos.BFF.Api.csproj", "{3272E8EA-B46B-49DF-9D29-B5BE758E87C4}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Core.Thalos.BFF.Api", "Core.Thalos.BFF.Api\Core.Thalos.BFF.Api.csproj", "{3272E8EA-B46B-49DF-9D29-B5BE758E87C4}"
EndProject EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Core.Cerberos.External", "Core.Cerberos.External\Core.Cerberos.External.csproj", "{3111115C-A391-4A4C-A886-016A92BAC20E}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Core.Thalos.External", "Core.Thalos.External\Core.Thalos.External.csproj", "{3111115C-A391-4A4C-A886-016A92BAC20E}"
EndProject EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Application", "Application", "{CBFF88ED-B50D-4A71-BB2A-C0B2BBA489CA}" Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Application", "Application", "{CBFF88ED-B50D-4A71-BB2A-C0B2BBA489CA}"
EndProject EndProject

View File

@@ -1,14 +1,14 @@
using Core.Cerberos.Adapters.Contracts; using Core.Thalos.Adapters.Contracts;
using Core.Cerberos.Adapters.Handlers; using Core.Thalos.Adapters.Handlers;
using Core.Cerberos.Adapters.TokenProvider; using Core.Thalos.Adapters.TokenProvider;
using Core.Cerberos.External.GatewayConfigurations; using Core.Thalos.External.GatewayConfigurations;
using LSA.Dashboard.External.Clients.Dashboard; using LSA.Dashboard.External.Clients.Dashboard;
using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Refit; using Refit;
namespace Core.Cerberos.External.ClientConfiguration namespace Core.Thalos.External.ClientConfiguration
{ {
public static class RegisterClientConfiguration public static class RegisterClientConfiguration
{ {
@@ -43,7 +43,7 @@ namespace Core.Cerberos.External.ClientConfiguration
return handler; return handler;
}); });
var cerberosServiceApiUrl = GatewaySettingsConfigurations.GetCerberosServiceAPIEndpoint().Endpoint.Url; var thalosServiceApiUrl = GatewaySettingsConfigurations.GetThalosServiceAPIEndpoint().Endpoint.Url;
// Register IDashBoardServiceClient with the manually created HttpClient // Register IDashBoardServiceClient with the manually created HttpClient
services.AddScoped(provider => services.AddScoped(provider =>
@@ -55,10 +55,10 @@ namespace Core.Cerberos.External.ClientConfiguration
var httpClient = new HttpClient(handlerTrackingId) var httpClient = new HttpClient(handlerTrackingId)
{ {
BaseAddress = new Uri(cerberosServiceApiUrl), BaseAddress = new Uri(thalosServiceApiUrl),
Timeout = TimeSpan.FromMinutes(1) Timeout = TimeSpan.FromMinutes(1)
}; };
return RestService.For<ICerberosServiceClient>(httpClient); return RestService.For<IThalosServiceClient>(httpClient);
}); });
return services; return services;

View File

@@ -1,14 +1,14 @@
using Core.Cerberos.Adapters; using Core.Thalos.Adapters;
using Core.Cerberos.Application.UseCases.Roles.Input; using Core.Thalos.Application.UseCases.Roles.Input;
using Core.Cerberos.Application.UseCases.Users.Input; using Core.Thalos.Application.UseCases.Users.Input;
using Core.Cerberos.External.Clients.Cerberos.Requests.Permissions; using Core.Thalos.External.Clients.Thalos.Requests.Permissions;
using Core.Cerberos.External.Clients.Cerberos.Requests.Users; using Core.Thalos.External.Clients.Thalos.Requests.Users;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Refit; using Refit;
namespace LSA.Dashboard.External.Clients.Dashboard namespace LSA.Dashboard.External.Clients.Dashboard
{ {
public interface ICerberosServiceClient public interface IThalosServiceClient
{ {
[Post("/v1/User/Create")] [Post("/v1/User/Create")]
Task<ApiResponse<UserAdapter>> CreateUserService([Header("TrackingId")][Body] CreateUserRequest request, CancellationToken cancellationToken = default); Task<ApiResponse<UserAdapter>> CreateUserService([Header("TrackingId")][Body] CreateUserRequest request, CancellationToken cancellationToken = default);

View File

@@ -1,6 +1,6 @@
using Core.Cerberos.Adapters.Common.Enums; using Core.Thalos.Adapters.Common.Enums;
namespace Core.Cerberos.External.Clients.Cerberos.Requests.Permissions namespace Core.Thalos.External.Clients.Thalos.Requests.Permissions
{ {
public class ChangeModuleStatusRequest public class ChangeModuleStatusRequest
{ {

View File

@@ -1,6 +1,6 @@
using Core.Cerberos.Adapters.Common.Enums; using Core.Thalos.Adapters.Common.Enums;
namespace Core.Cerberos.External.Clients.Cerberos.Requests.Permissions namespace Core.Thalos.External.Clients.Thalos.Requests.Permissions
{ {
public class CreateModuleRequest public class CreateModuleRequest
{ {

View File

@@ -1,4 +1,4 @@
namespace Core.Cerberos.External.Clients.Cerberos.Requests.Permissions namespace Core.Thalos.External.Clients.Thalos.Requests.Permissions
{ {
public class GetAllModulesByListRequest public class GetAllModulesByListRequest
{ {

View File

@@ -0,0 +1,6 @@
namespace Core.Thalos.External.Clients.Thalos.Requests.Permissions
{
public class GetAllModulesRequest
{
}
}

View File

@@ -1,4 +1,4 @@
namespace Core.Cerberos.External.Clients.Cerberos.Requests.Permissions namespace Core.Thalos.External.Clients.Thalos.Requests.Permissions
{ {
public class GetModuleRequest public class GetModuleRequest
{ {

View File

@@ -1,6 +1,6 @@
using Core.Cerberos.Adapters.Common.Enums; using Core.Thalos.Adapters.Common.Enums;
namespace Core.Cerberos.External.Clients.Cerberos.Requests.Permissions namespace Core.Thalos.External.Clients.Thalos.Requests.Permissions
{ {
public class UpdateModuleRequest public class UpdateModuleRequest
{ {

View File

@@ -1,6 +1,6 @@
using Core.Cerberos.Adapters.Common.Enums; using Core.Thalos.Adapters.Common.Enums;
namespace Core.Cerberos.External.Clients.Cerberos.Requests.Permissions namespace Core.Thalos.External.Clients.Thalos.Requests.Permissions
{ {
public class ChangePermissionStatusRequest public class ChangePermissionStatusRequest
{ {

View File

@@ -1,6 +1,6 @@
using Core.Cerberos.Adapters.Common.Constants; using Core.Thalos.Adapters.Common.Constants;
namespace Core.Cerberos.External.Clients.Cerberos.Requests.Permissions namespace Core.Thalos.External.Clients.Thalos.Requests.Permissions
{ {
public class CreatePermissionRequest public class CreatePermissionRequest
{ {

View File

@@ -1,4 +1,4 @@
namespace Core.Cerberos.External.Clients.Cerberos.Requests.Permissions namespace Core.Thalos.External.Clients.Thalos.Requests.Permissions
{ {
public class GetAllPermissionsByListRequest public class GetAllPermissionsByListRequest
{ {

View File

@@ -0,0 +1,6 @@
namespace Core.Thalos.External.Clients.Thalos.Requests.Permissions
{
public class GetAllPermissionsRequest
{
}
}

View File

@@ -1,4 +1,4 @@
namespace Core.Cerberos.External.Clients.Cerberos.Requests.Permissions namespace Core.Thalos.External.Clients.Thalos.Requests.Permissions
{ {
public class GetPermissionRequest public class GetPermissionRequest
{ {

View File

@@ -1,7 +1,7 @@
using Core.Cerberos.Adapters.Common.Constants; using Core.Thalos.Adapters.Common.Constants;
using Core.Cerberos.Adapters.Common.Enums; using Core.Thalos.Adapters.Common.Enums;
namespace Core.Cerberos.External.Clients.Cerberos.Requests.Permissions namespace Core.Thalos.External.Clients.Thalos.Requests.Permissions
{ {
public class UpdatePermissionRequest public class UpdatePermissionRequest
{ {

View File

@@ -1,6 +1,6 @@
using Core.Cerberos.Adapters.Common.Enums; using Core.Thalos.Adapters.Common.Enums;
namespace Core.Cerberos.Application.UseCases.Roles.Input namespace Core.Thalos.Application.UseCases.Roles.Input
{ {
public class AddApplicationToRoleRequest public class AddApplicationToRoleRequest
{ {

View File

@@ -1,6 +1,6 @@
using Core.Cerberos.Adapters.Common.Enums; using Core.Thalos.Adapters.Common.Enums;
namespace Core.Cerberos.Application.UseCases.Roles.Input namespace Core.Thalos.Application.UseCases.Roles.Input
{ {
public class ChangeRoleStatusRequest public class ChangeRoleStatusRequest
{ {

View File

@@ -1,7 +1,7 @@
using Core.Cerberos.Adapters.Common.Enums; using Core.Thalos.Adapters.Common.Enums;
using System.Text.Json.Serialization; using System.Text.Json.Serialization;
namespace Core.Cerberos.Application.UseCases.Roles.Input namespace Core.Thalos.Application.UseCases.Roles.Input
{ {
public class CreateRoleRequest public class CreateRoleRequest
{ {

View File

@@ -0,0 +1,6 @@
namespace Core.Thalos.Application.UseCases.Roles.Input
{
public class GetAllRolesRequest
{
}
}

View File

@@ -1,4 +1,4 @@
namespace Core.Cerberos.Application.UseCases.Roles.Input namespace Core.Thalos.Application.UseCases.Roles.Input
{ {
public class GetRoleRequest public class GetRoleRequest
{ {

View File

@@ -1,6 +1,6 @@
using Core.Cerberos.Adapters.Common.Enums; using Core.Thalos.Adapters.Common.Enums;
namespace Core.Cerberos.Application.UseCases.Roles.Input namespace Core.Thalos.Application.UseCases.Roles.Input
{ {
public class RemoveApplicationFromRoleRequest public class RemoveApplicationFromRoleRequest
{ {

View File

@@ -1,7 +1,7 @@
using Core.Cerberos.Adapters.Common.Enums; using Core.Thalos.Adapters.Common.Enums;
using System.Text.Json.Serialization; using System.Text.Json.Serialization;
namespace Core.Cerberos.Application.UseCases.Roles.Input namespace Core.Thalos.Application.UseCases.Roles.Input
{ {
public class UpdateRoleRequest public class UpdateRoleRequest
{ {

View File

@@ -1,4 +1,4 @@
namespace Core.Cerberos.Application.UseCases.Users.Input namespace Core.Thalos.Application.UseCases.Users.Input
{ {
public class AddCompanyToUserRequest public class AddCompanyToUserRequest
{ {

View File

@@ -1,4 +1,4 @@
namespace Core.Cerberos.Application.UseCases.Users.Input namespace Core.Thalos.Application.UseCases.Users.Input
{ {
public class AddProjectToUserRequest public class AddProjectToUserRequest
{ {

View File

@@ -1,6 +1,6 @@
using Core.Cerberos.Adapters.Common.Enums; using Core.Thalos.Adapters.Common.Enums;
namespace Core.Cerberos.Application.UseCases.Users.Input namespace Core.Thalos.Application.UseCases.Users.Input
{ {
public class ChangeUserStatusRequest public class ChangeUserStatusRequest
{ {

View File

@@ -1,4 +1,4 @@
namespace Core.Cerberos.Application.UseCases.Users.Input namespace Core.Thalos.Application.UseCases.Users.Input
{ {
public class CreateUserRequest public class CreateUserRequest
{ {

View File

@@ -0,0 +1,6 @@
namespace Core.Thalos.Application.UseCases.Users.Input
{
public class GetAllUsersRequest
{
}
}

View File

@@ -1,4 +1,4 @@
namespace Core.Cerberos.Application.UseCases.Users.Input namespace Core.Thalos.Application.UseCases.Users.Input
{ {
public class GetUserByEmailRequest public class GetUserByEmailRequest
{ {

View File

@@ -1,4 +1,4 @@
namespace Core.Cerberos.Application.UseCases.Users.Input namespace Core.Thalos.Application.UseCases.Users.Input
{ {
public class GetTokenAdapterRequest public class GetTokenAdapterRequest
{ {

View File

@@ -1,4 +1,4 @@
namespace Core.Cerberos.Application.UseCases.Users.Input namespace Core.Thalos.Application.UseCases.Users.Input
{ {
public class GetUserRequest public class GetUserRequest
{ {

View File

@@ -1,4 +1,4 @@
namespace Core.Cerberos.External.Clients.Cerberos.Requests.Users namespace Core.Thalos.External.Clients.Thalos.Requests.Users
{ {
public class LoginUserRequest public class LoginUserRequest
{ {

View File

@@ -1,4 +1,4 @@
namespace Core.Cerberos.External.Clients.Cerberos.Requests.Users namespace Core.Thalos.External.Clients.Thalos.Requests.Users
{ {
public class LogoutUserRequest public class LogoutUserRequest
{ {

View File

@@ -1,4 +1,4 @@
namespace Core.Cerberos.Application.UseCases.Users.Input namespace Core.Thalos.Application.UseCases.Users.Input
{ {
public class RemoveCompanyFromUserRequest public class RemoveCompanyFromUserRequest
{ {

View File

@@ -1,4 +1,4 @@
namespace Core.Cerberos.Application.UseCases.Users.Input namespace Core.Thalos.Application.UseCases.Users.Input
{ {
public class RemoveProjectFromUserRequest public class RemoveProjectFromUserRequest
{ {

View File

@@ -1,6 +1,6 @@
using Core.Cerberos.Adapters.Common.Enums; using Core.Thalos.Adapters.Common.Enums;
namespace Core.Cerberos.Application.UseCases.Users.Input namespace Core.Thalos.Application.UseCases.Users.Input
{ {
public class UpdateUserRequest public class UpdateUserRequest
{ {

View File

@@ -1,4 +1,4 @@
namespace Core.Cerberos.Application.UseCases.Users.Input namespace Core.Thalos.Application.UseCases.Users.Input
{ {
public class ValidateUserExistenceRequest public class ValidateUserExistenceRequest
{ {

View File

@@ -8,7 +8,7 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="BuildingBlocks.Library" Version="0.0.1" /> <PackageReference Include="BuildingBlocks.Library" Version="0.0.1" />
<PackageReference Include="Cerberos.Building.Blocks" Version="0.0.3" /> <PackageReference Include="Thalos.Building.Blocks" Version="0.0.1" />
<PackageReference Include="Refit" Version="8.0.0" /> <PackageReference Include="Refit" Version="8.0.0" />
</ItemGroup> </ItemGroup>

View File

@@ -1,17 +1,17 @@
using Core.Blueprint.External; using Core.Blueprint.External;
namespace Core.Cerberos.External.GatewayConfigurations namespace Core.Thalos.External.GatewayConfigurations
{ {
public record GatewayConfiguration public record GatewayConfiguration
{ {
public GatewayConfiguration() public GatewayConfiguration()
{ {
CerberosService = new CerberosServiceAPI(); ThalosService = new ThalosServiceAPI();
} }
public CerberosServiceAPI CerberosService { get; set; } public ThalosServiceAPI ThalosService { get; set; }
} }
public record CerberosServiceAPI public record ThalosServiceAPI
{ {
public string Channel { get; set; } public string Channel { get; set; }
public BaseEndpoint Endpoint { get; set; } public BaseEndpoint Endpoint { get; set; }

View File

@@ -1,7 +1,7 @@
using Core.Blueprint.External; using Core.Blueprint.External;
using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Configuration;
namespace Core.Cerberos.External.GatewayConfigurations namespace Core.Thalos.External.GatewayConfigurations
{ {
public class GatewaySettingsConfigurations public class GatewaySettingsConfigurations
{ {
@@ -13,9 +13,9 @@ namespace Core.Cerberos.External.GatewayConfigurations
_configuration = configuration; _configuration = configuration;
SetDashboardServiceAPIEndpoint(); SetDashboardServiceAPIEndpoint();
} }
public static CerberosServiceAPI GetCerberosServiceAPIEndpoint() public static ThalosServiceAPI GetThalosServiceAPIEndpoint()
{ {
return GatewayConfigurations.CerberosService; return GatewayConfigurations.ThalosService;
} }
private GatewayConfiguration SetDashboardServiceAPIEndpoint() private GatewayConfiguration SetDashboardServiceAPIEndpoint()
{ {
@@ -27,18 +27,18 @@ namespace Core.Cerberos.External.GatewayConfigurations
else else
source = _configuration.GetSection("Gateways"); source = _configuration.GetSection("Gateways");
var endpoint = source["CerberosService"] ?? string.Empty; var endpoint = source["ThalosService"] ?? string.Empty;
if (string.IsNullOrEmpty(endpoint)) throw new Exception("Cerberos Service endpoint is empty or null"); if (string.IsNullOrEmpty(endpoint)) throw new Exception("Thalos Service endpoint is empty or null");
GatewayConfigurations.CerberosService = new CerberosServiceAPI() GatewayConfigurations.ThalosService = new ThalosServiceAPI()
{ {
Endpoint = new BaseEndpoint() Endpoint = new BaseEndpoint()
{ {
Uri = new Uri(endpoint), Uri = new Uri(endpoint),
Url = endpoint, Url = endpoint,
Token = string.Empty, Token = string.Empty,
APIName = "Cerberos Service" APIName = "Thalos Service"
} }
}; };

View File

@@ -1,6 +1,6 @@
using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http;
namespace Core.Cerberos.External namespace Core.Thalos.External
{ {
public sealed class TrackingMechanismExtension(IHttpContextAccessor httpContextAccessor) : DelegatingHandler public sealed class TrackingMechanismExtension(IHttpContextAccessor httpContextAccessor) : DelegatingHandler
{ {