Compare commits
10 Commits
feature/im
...
feature/ad
| Author | SHA1 | Date | |
|---|---|---|---|
| 69f0590e8d | |||
| 42f213e09d | |||
| 69e21e276c | |||
| 6a055bc3db | |||
| 4e620e92f6 | |||
|
|
482a330a39 | ||
| 0429704cac | |||
| 3b0c31c38e | |||
|
|
cfd6b16e24 | ||
|
|
bb87b0e148 |
@@ -1,6 +0,0 @@
|
|||||||
@Core.Cerberos.BFF.Api_HostAddress = http://localhost:5219
|
|
||||||
|
|
||||||
GET {{Core.Cerberos.BFF.Api_HostAddress}}/weatherforecast/
|
|
||||||
Accept: application/json
|
|
||||||
|
|
||||||
###
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
{
|
|
||||||
"Logging": {
|
|
||||||
"LogLevel": {
|
|
||||||
"Default": "Information",
|
|
||||||
"Microsoft.AspNetCore": "Warning"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"AllowedHosts": "*",
|
|
||||||
"Endpoints": {
|
|
||||||
"AppConfigurationURI": "https://sandbox-hci-usc-appcg.azconfig.io"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
using Core.Cerberos.Adapters.Common.Enums;
|
|
||||||
|
|
||||||
namespace Core.Cerberos.External.Clients.Cerberos.Requests.Permissions
|
|
||||||
{
|
|
||||||
public class ChangeModuleStatusRequest
|
|
||||||
{
|
|
||||||
public string Id { get; set; }
|
|
||||||
public StatusEnum Status { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
namespace Core.Cerberos.External.Clients.Cerberos.Requests.Permissions
|
|
||||||
{
|
|
||||||
public class GetAllModulesRequest
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
namespace Core.Cerberos.External.Clients.Cerberos.Requests.Permissions
|
|
||||||
{
|
|
||||||
public class GetModuleRequest
|
|
||||||
{
|
|
||||||
public string Id { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
using Core.Cerberos.Adapters.Common.Enums;
|
|
||||||
|
|
||||||
namespace Core.Cerberos.External.Clients.Cerberos.Requests.Permissions
|
|
||||||
{
|
|
||||||
public class ChangePermissionStatusRequest
|
|
||||||
{
|
|
||||||
public string Id { get; set; }
|
|
||||||
public StatusEnum Status { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
namespace Core.Cerberos.External.Clients.Cerberos.Requests.Permissions
|
|
||||||
{
|
|
||||||
public class GetAllPermissionsRequest
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
namespace Core.Cerberos.External.Clients.Cerberos.Requests.Permissions
|
|
||||||
{
|
|
||||||
public class GetPermissionRequest
|
|
||||||
{
|
|
||||||
public string Id { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
using Core.Cerberos.Adapters.Common.Enums;
|
|
||||||
|
|
||||||
namespace Core.Cerberos.Application.UseCases.Roles.Input
|
|
||||||
{
|
|
||||||
public class ChangeRoleStatusRequest
|
|
||||||
{
|
|
||||||
public string Id { get; set; }
|
|
||||||
public StatusEnum Status { get; set; }
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
namespace Core.Cerberos.Application.UseCases.Roles.Input
|
|
||||||
{
|
|
||||||
public class GetAllRolesRequest
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
namespace Core.Cerberos.Application.UseCases.Roles.Input
|
|
||||||
{
|
|
||||||
public class GetRoleRequest
|
|
||||||
{
|
|
||||||
public string Id { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
namespace Core.Cerberos.Application.UseCases.Users.Input
|
|
||||||
{
|
|
||||||
public class AddCompanyToUserRequest
|
|
||||||
{
|
|
||||||
public string UserId { get; set; }
|
|
||||||
public string CompanyId { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
namespace Core.Cerberos.Application.UseCases.Users.Input
|
|
||||||
{
|
|
||||||
public class AddProjectToUserRequest
|
|
||||||
{
|
|
||||||
public string UserId { get; set; }
|
|
||||||
public string ProjectId { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
using Core.Cerberos.Adapters.Common.Enums;
|
|
||||||
|
|
||||||
namespace Core.Cerberos.Application.UseCases.Users.Input
|
|
||||||
{
|
|
||||||
public class ChangeUserStatusRequest
|
|
||||||
{
|
|
||||||
public string Id { get; set; }
|
|
||||||
public StatusEnum Status { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
namespace Core.Cerberos.Application.UseCases.Users.Input
|
|
||||||
{
|
|
||||||
public class GetAllUsersRequest
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
namespace Core.Cerberos.Application.UseCases.Users.Input
|
|
||||||
{
|
|
||||||
public class GetUserRequest
|
|
||||||
{
|
|
||||||
public string Id { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
namespace Core.Cerberos.Application.UseCases.Users.Input
|
|
||||||
{
|
|
||||||
public class RemoveCompanyFromUserRequest
|
|
||||||
{
|
|
||||||
public string UserId { get; set; }
|
|
||||||
public string CompanyId { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
namespace Core.Cerberos.Application.UseCases.Users.Input
|
|
||||||
{
|
|
||||||
public class RemoveProjectFromUserRequest
|
|
||||||
{
|
|
||||||
public string UserId { get; set; }
|
|
||||||
public string ProjectId { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,14 +1,12 @@
|
|||||||
using Asp.Versioning;
|
using Asp.Versioning;
|
||||||
using Core.Cerberos.Adapters;
|
using Core.Thalos.Application.UseCases.Users.Input;
|
||||||
using Core.Cerberos.Adapters.Common.Constants;
|
using Core.Thalos.BuildingBlocks;
|
||||||
using Core.Cerberos.Adapters.Contracts;
|
using Core.Thalos.External.Clients.Thalos.Requests.Users;
|
||||||
using Core.Cerberos.Application.UseCases.Users.Input;
|
|
||||||
using Core.Cerberos.External.Clients.Cerberos.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,8 +16,22 @@ 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,
|
||||||
|
IGoogleAuthorization googleAuthorization) : BaseController(logger)
|
||||||
{
|
{
|
||||||
|
[HttpGet]
|
||||||
|
public IActionResult Authorize() => Ok(googleAuthorization.GetAuthorizationUrl());
|
||||||
|
|
||||||
|
[HttpGet("callback")]
|
||||||
|
public async Task<IActionResult> Callback(string code)
|
||||||
|
{
|
||||||
|
var userCredential = await googleAuthorization.ExchangeCodeForToken(code);
|
||||||
|
|
||||||
|
return Ok(new { Token = userCredential!.Token.IdToken });
|
||||||
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get token for user.
|
/// Get token for user.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -30,7 +42,7 @@ namespace Core.Cerberos.BFF.Api.Controllers
|
|||||||
[HttpGet]
|
[HttpGet]
|
||||||
[Route(Routes.GenerateToken)]
|
[Route(Routes.GenerateToken)]
|
||||||
[ProducesResponseType(typeof(UserAdapter), StatusCodes.Status200OK)]
|
[ProducesResponseType(typeof(UserAdapter), StatusCodes.Status200OK)]
|
||||||
[Authorize(AuthenticationSchemes = Schemes.AzureScheme)]
|
[Authorize(AuthenticationSchemes = Schemes.GoogleScheme)]
|
||||||
public async Task<IActionResult> GenerateTokenService(CancellationToken cancellationToken)
|
public async Task<IActionResult> GenerateTokenService(CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@@ -43,7 +55,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 +66,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 +93,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)
|
||||||
{
|
{
|
||||||
@@ -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]
|
||||||
@@ -1,15 +1,13 @@
|
|||||||
using Asp.Versioning;
|
using Asp.Versioning;
|
||||||
using Core.Cerberos.Adapters;
|
using Core.Thalos.BuildingBlocks;
|
||||||
using Core.Cerberos.Adapters.Attributes;
|
using Core.Thalos.External.Clients.Thalos.Requests.Permissions;
|
||||||
using Core.Cerberos.Adapters.Common.Constants;
|
|
||||||
using Core.Cerberos.External.Clients.Cerberos.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,11 +17,11 @@ 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 modules.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[HttpGet("GetAll")]
|
[HttpGet("GetAll")]
|
||||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||||
@@ -39,7 +37,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)
|
||||||
{
|
{
|
||||||
@@ -49,7 +47,7 @@ namespace Core.Cerberos.BFF.Api.Controllers
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets all the modules by module identifiers.
|
/// Gets all modules by module identifiers.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="request">The request containing the list of module identifiers.</param>
|
/// <param name="request">The request containing the list of module identifiers.</param>
|
||||||
/// <param name="cancellationToken">Cancellation token for the asynchronous operation.</param>
|
/// <param name="cancellationToken">Cancellation token for the asynchronous operation.</param>
|
||||||
@@ -77,7 +75,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 +111,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)
|
||||||
{
|
{
|
||||||
@@ -139,9 +137,9 @@ namespace Core.Cerberos.BFF.Api.Controllers
|
|||||||
{
|
{
|
||||||
logger.LogInformation($"{nameof(GetModuleByIdService)} - Request received - Payload: {JsonSerializer.Serialize(request)}");
|
logger.LogInformation($"{nameof(GetModuleByIdService)} - Request received - Payload: {JsonSerializer.Serialize(request)}");
|
||||||
|
|
||||||
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 +173,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)
|
||||||
{
|
{
|
||||||
@@ -203,9 +201,9 @@ namespace Core.Cerberos.BFF.Api.Controllers
|
|||||||
{
|
{
|
||||||
logger.LogInformation($"{nameof(ChangeModuleStatusService)} - Request received - Payload: {JsonSerializer.Serialize(request)}");
|
logger.LogInformation($"{nameof(ChangeModuleStatusService)} - Request received - Payload: {JsonSerializer.Serialize(request)}");
|
||||||
|
|
||||||
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)
|
||||||
{
|
{
|
||||||
@@ -1,16 +1,13 @@
|
|||||||
using Asp.Versioning;
|
using Asp.Versioning;
|
||||||
using Core.Cerberos.Adapters;
|
using Core.Thalos.BuildingBlocks;
|
||||||
using Core.Cerberos.Adapters.Attributes;
|
using Core.Thalos.External.Clients.Thalos.Requests.Permissions;
|
||||||
using Core.Cerberos.Adapters.Common.Constants;
|
|
||||||
using Core.Cerberos.External.Clients.Cerberos.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 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,11 +17,11 @@ 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 permissions.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[HttpGet("GetAll")]
|
[HttpGet("GetAll")]
|
||||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||||
@@ -40,7 +37,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)
|
||||||
{
|
{
|
||||||
@@ -50,7 +47,7 @@ namespace Core.Cerberos.BFF.Api.Controllers
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets all the permissions by permission identifiers.
|
/// Gets all permissions by permission identifiers.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="request">The request containing the list of permission identifiers.</param>
|
/// <param name="request">The request containing the list of permission identifiers.</param>
|
||||||
/// <param name="cancellationToken">Cancellation token for the asynchronous operation.</param>
|
/// <param name="cancellationToken">Cancellation token for the asynchronous operation.</param>
|
||||||
@@ -78,7 +75,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 +109,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)
|
||||||
{
|
{
|
||||||
@@ -138,9 +135,9 @@ namespace Core.Cerberos.BFF.Api.Controllers
|
|||||||
{
|
{
|
||||||
logger.LogInformation($"{nameof(GetPermissionByIdService)} - Request received - Payload: {JsonSerializer.Serialize(request)}");
|
logger.LogInformation($"{nameof(GetPermissionByIdService)} - Request received - Payload: {JsonSerializer.Serialize(request)}");
|
||||||
|
|
||||||
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 +169,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)
|
||||||
{
|
{
|
||||||
@@ -200,9 +197,9 @@ namespace Core.Cerberos.BFF.Api.Controllers
|
|||||||
{
|
{
|
||||||
logger.LogInformation($"{nameof(ChangePermissionStatusService)} - Request received - Payload: {JsonSerializer.Serialize(request)}");
|
logger.LogInformation($"{nameof(ChangePermissionStatusService)} - Request received - Payload: {JsonSerializer.Serialize(request)}");
|
||||||
|
|
||||||
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)
|
||||||
{
|
{
|
||||||
@@ -1,14 +1,13 @@
|
|||||||
using Asp.Versioning;
|
using Asp.Versioning;
|
||||||
using Core.Cerberos.Adapters.Attributes;
|
using Core.Thalos.Application.UseCases.Roles.Input;
|
||||||
using Core.Cerberos.Adapters.Common.Constants;
|
using Core.Thalos.BuildingBlocks;
|
||||||
using Core.Cerberos.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,11 +17,11 @@ 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 roles.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[HttpGet("GetAll")]
|
[HttpGet("GetAll")]
|
||||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||||
@@ -38,7 +37,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 +75,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)
|
||||||
{
|
{
|
||||||
@@ -102,9 +101,9 @@ namespace Core.Cerberos.BFF.Api.Controllers
|
|||||||
{
|
{
|
||||||
logger.LogInformation($"{nameof(GetRoleByIdService)} - Request received - Payload: {JsonSerializer.Serialize(request)}");
|
logger.LogInformation($"{nameof(GetRoleByIdService)} - Request received - Payload: {JsonSerializer.Serialize(request)}");
|
||||||
|
|
||||||
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)
|
||||||
{
|
{
|
||||||
@@ -134,7 +133,7 @@ namespace Core.Cerberos.BFF.Api.Controllers
|
|||||||
|
|
||||||
if (string.IsNullOrEmpty(request.Name)) return BadRequest("Invalid role name");
|
if (string.IsNullOrEmpty(request.Name)) return BadRequest("Invalid role name");
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(request.Id)) return BadRequest("Invalid role identifier");
|
if (string.IsNullOrEmpty(request._Id)) return BadRequest("Invalid role identifier");
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(request.Description)) return BadRequest("Invalid role description");
|
if (string.IsNullOrEmpty(request.Description)) return BadRequest("Invalid role description");
|
||||||
|
|
||||||
@@ -145,7 +144,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)
|
||||||
{
|
{
|
||||||
@@ -173,9 +172,9 @@ namespace Core.Cerberos.BFF.Api.Controllers
|
|||||||
{
|
{
|
||||||
logger.LogInformation($"{nameof(ChangeRoleStatusService)} - Request received - Payload: {JsonSerializer.Serialize(request)}");
|
logger.LogInformation($"{nameof(ChangeRoleStatusService)} - Request received - Payload: {JsonSerializer.Serialize(request)}");
|
||||||
|
|
||||||
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 +204,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 +234,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)
|
||||||
{
|
{
|
||||||
196
Core.Thalos.BFF.Api/Controllers/TenantController.cs
Normal file
196
Core.Thalos.BFF.Api/Controllers/TenantController.cs
Normal file
@@ -0,0 +1,196 @@
|
|||||||
|
using Asp.Versioning;
|
||||||
|
using Core.Thalos.BuildingBlocks;
|
||||||
|
using Core.Thalos.External.Clients.Thalos.Requests.Tenants;
|
||||||
|
using Lib.Architecture.BuildingBlocks;
|
||||||
|
using LSA.Dashboard.External.Clients.Dashboard;
|
||||||
|
using Microsoft.AspNetCore.Authorization;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using System.Text.Json;
|
||||||
|
|
||||||
|
namespace Core.Thalos.BFF.Api.Controllers
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Handles all requests for Tenant authentication.
|
||||||
|
/// </summary>
|
||||||
|
[ApiVersion("1.0")]
|
||||||
|
[Route("api/v{version:apiVersion}/[controller]")]
|
||||||
|
[Consumes("application/json")]
|
||||||
|
[Produces("application/json")]
|
||||||
|
[ApiController]
|
||||||
|
[Authorize(AuthenticationSchemes = Schemes.DefaultScheme)]
|
||||||
|
public class TenantController(IThalosServiceClient thalosServiceClient, ILogger<TenantController> logger) : BaseController(logger)
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets all Tenants.
|
||||||
|
/// </summary>
|
||||||
|
[HttpGet("GetAll")]
|
||||||
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||||
|
[ProducesResponseType(StatusCodes.Status400BadRequest)]
|
||||||
|
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||||
|
[ProducesResponseType(typeof(Notification), StatusCodes.Status412PreconditionFailed)]
|
||||||
|
[ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)]
|
||||||
|
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||||
|
[Permission("TenantManagement.Read, RoleManagement.Read")]
|
||||||
|
public async Task<IActionResult> GetAllTenantsService(CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
logger.LogInformation($"{nameof(GetAllTenantsService)} - Request received - Payload: ");
|
||||||
|
|
||||||
|
return await Handle(() => thalosServiceClient.GetAllTenantsService(new GetAllTenantsRequest { }, cancellationToken)).ConfigureAwait(false);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
logger.LogError($"{nameof(GetAllTenantsService)} - An Error Occurred- {ex.Message} - {ex.InnerException} - {ex.StackTrace} - with payload");
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Creates a new Tenant.
|
||||||
|
/// </summary>
|
||||||
|
[HttpPost("Create")]
|
||||||
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||||
|
[ProducesResponseType(StatusCodes.Status400BadRequest)]
|
||||||
|
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||||
|
[ProducesResponseType(typeof(Notification), StatusCodes.Status412PreconditionFailed)]
|
||||||
|
[ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)]
|
||||||
|
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||||
|
[Permission("TenantManagement.Write")]
|
||||||
|
public async Task<IActionResult> CreateTenantService(CreateTenantRequest newTenant, CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
logger.LogInformation($"{nameof(CreateTenantService)} - Request received - Payload: {JsonSerializer.Serialize(newTenant)}");
|
||||||
|
|
||||||
|
if (newTenant == null) return BadRequest("Invalid Tenant object");
|
||||||
|
|
||||||
|
if (string.IsNullOrEmpty(newTenant.Name)) return BadRequest("Invalid Tenant name");
|
||||||
|
|
||||||
|
return await Handle(() => thalosServiceClient.CreateTenantService(newTenant, cancellationToken)).ConfigureAwait(false);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
logger.LogError($"{nameof(CreateTenantService)} - An Error Occurred- {ex.Message} - {ex.InnerException} - {ex.StackTrace} - with payload {JsonSerializer.Serialize(newTenant)}");
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the Tenant by identifier.
|
||||||
|
/// </summary>
|
||||||
|
[HttpPost("GetById")]
|
||||||
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||||
|
[ProducesResponseType(StatusCodes.Status400BadRequest)]
|
||||||
|
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||||
|
[ProducesResponseType(typeof(Notification), StatusCodes.Status412PreconditionFailed)]
|
||||||
|
[ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)]
|
||||||
|
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||||
|
[Permission("TenantManagement.Read")]
|
||||||
|
public async Task<IActionResult> GetTenantByIdService(GetTenantRequest request, CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
logger.LogInformation($"{nameof(GetTenantByIdService)} - Request received - Payload: {JsonSerializer.Serialize(request)}");
|
||||||
|
|
||||||
|
if (string.IsNullOrEmpty(request._Id)) return BadRequest("Invalid Tenant identifier");
|
||||||
|
|
||||||
|
return await Handle(() => thalosServiceClient.GetTenantByIdService(request, cancellationToken)).ConfigureAwait(false);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
logger.LogError($"{nameof(GetTenantByIdService)} - An Error Occurred- {ex.Message} - {ex.InnerException} - {ex.StackTrace} - with payload {JsonSerializer.Serialize(request)}");
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Updates a full Tenant by identifier.
|
||||||
|
/// </summary>
|
||||||
|
[HttpPut("Update")]
|
||||||
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||||
|
[ProducesResponseType(StatusCodes.Status400BadRequest)]
|
||||||
|
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||||
|
[ProducesResponseType(typeof(Notification), StatusCodes.Status412PreconditionFailed)]
|
||||||
|
[ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)]
|
||||||
|
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||||
|
[Permission("TenantManagement.Write")]
|
||||||
|
public async Task<IActionResult> UpdateTenantService(UpdateTenantRequest newTenant, CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
logger.LogInformation($"{nameof(UpdateTenantService)} - Request received - Payload: {JsonSerializer.Serialize(newTenant)}");
|
||||||
|
|
||||||
|
if (newTenant == null) return BadRequest("Invalid Tenant object");
|
||||||
|
|
||||||
|
if (string.IsNullOrEmpty(newTenant.Name)) return BadRequest("Invalid Tenant name");
|
||||||
|
|
||||||
|
|
||||||
|
return await Handle(() => thalosServiceClient.UpdateTenantService(newTenant, cancellationToken)).ConfigureAwait(false);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
logger.LogError($"{nameof(UpdateTenantService)} - An Error Occurred- {ex.Message} - {ex.InnerException} - {ex.StackTrace} - with payload {JsonSerializer.Serialize(newTenant)}");
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Changes the status of the Tenant.
|
||||||
|
/// </summary>
|
||||||
|
[HttpPatch]
|
||||||
|
[Route("ChangeStatus")]
|
||||||
|
[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)]
|
||||||
|
[Permission("TenantManagement.Write")]
|
||||||
|
public async Task<IActionResult> ChangeTenantStatusService([FromBody] ChangeTenantStatusRequest request, CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
logger.LogInformation($"{nameof(ChangeTenantStatusService)} - Request received - Payload: {JsonSerializer.Serialize(request)}");
|
||||||
|
|
||||||
|
if (string.IsNullOrEmpty(request._Id)) { return BadRequest("Invalid Tenant identifier"); }
|
||||||
|
|
||||||
|
return await Handle(() => thalosServiceClient.ChangeTenantStatusService(request, cancellationToken)).ConfigureAwait(false);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
logger.LogError($"{nameof(ChangeTenantStatusService)} - An Error Occurred- {ex.Message} - {ex.InnerException} - {ex.StackTrace} - with payload {JsonSerializer.Serialize(request)}");
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Deletes the Tenant by identifier.
|
||||||
|
/// </summary>
|
||||||
|
[HttpDelete("Delete")]
|
||||||
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||||
|
[ProducesResponseType(StatusCodes.Status400BadRequest)]
|
||||||
|
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||||
|
[ProducesResponseType(typeof(Notification), StatusCodes.Status412PreconditionFailed)]
|
||||||
|
[ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)]
|
||||||
|
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||||
|
[Permission("TenantManagement.Write")]
|
||||||
|
public async Task<IActionResult> DeleteTenantByIdService(DeleteTenantRequest request, CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
logger.LogInformation($"{nameof(DeleteTenantByIdService)} - Request received - Payload: {JsonSerializer.Serialize(request)}");
|
||||||
|
|
||||||
|
if (string.IsNullOrEmpty(request._Id)) return BadRequest("Invalid Tenant identifier");
|
||||||
|
|
||||||
|
return await Handle(() => thalosServiceClient.DeleteTenantByIdService(request, cancellationToken)).ConfigureAwait(false);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
logger.LogError($"{nameof(DeleteTenantByIdService)} - An Error Occurred- {ex.Message} - {ex.InnerException} - {ex.StackTrace} - with payload {JsonSerializer.Serialize(request)}");
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,15 +1,14 @@
|
|||||||
using Asp.Versioning;
|
using Asp.Versioning;
|
||||||
using Core.Cerberos.Adapters.Attributes;
|
using Core.Thalos.Application.UseCases.Users.Input;
|
||||||
using Core.Cerberos.Adapters.Common.Constants;
|
using Core.Thalos.BuildingBlocks;
|
||||||
using Core.Cerberos.Application.UseCases.Users.Input;
|
using Core.Thalos.External.Clients.Thalos.Requests.Users;
|
||||||
using Core.Cerberos.External.Clients.Cerberos.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,10 +18,10 @@ 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 users.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[HttpGet("GetAll")]
|
[HttpGet("GetAll")]
|
||||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||||
@@ -31,7 +30,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 +38,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 +57,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)
|
||||||
{
|
{
|
||||||
@@ -76,9 +75,7 @@ namespace Core.Cerberos.BFF.Api.Controllers
|
|||||||
|
|
||||||
if (string.IsNullOrEmpty(newUser.RoleId)) return BadRequest("Invalid role id");
|
if (string.IsNullOrEmpty(newUser.RoleId)) return BadRequest("Invalid role id");
|
||||||
|
|
||||||
if (!newUser.Companies.Any()) return BadRequest("The user must contain at least one company");
|
return await Handle(() => thalosServiceClient.CreateUserService(newUser, cancellationToken)).ConfigureAwait(false);
|
||||||
|
|
||||||
return await Handle(() => cerberosServiceClient.CreateUserService(newUser, cancellationToken)).ConfigureAwait(false);
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
@@ -97,7 +94,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)
|
||||||
{
|
{
|
||||||
@@ -105,9 +102,9 @@ namespace Core.Cerberos.BFF.Api.Controllers
|
|||||||
{
|
{
|
||||||
logger.LogInformation($"{nameof(GetUserByIdService)} - Request received - Payload: {JsonSerializer.Serialize(request)}");
|
logger.LogInformation($"{nameof(GetUserByIdService)} - Request received - Payload: {JsonSerializer.Serialize(request)}");
|
||||||
|
|
||||||
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 +123,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 +133,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 +152,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 +172,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 +191,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.GoogleScheme}, {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 +200,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 +219,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.GoogleScheme}, {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 +228,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 +249,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)
|
||||||
{
|
{
|
||||||
@@ -260,9 +257,9 @@ namespace Core.Cerberos.BFF.Api.Controllers
|
|||||||
{
|
{
|
||||||
logger.LogInformation($"{nameof(ChangeUserStatusService)} - Request received - Payload: {JsonSerializer.Serialize(request)}");
|
logger.LogInformation($"{nameof(ChangeUserStatusService)} - Request received - Payload: {JsonSerializer.Serialize(request)}");
|
||||||
|
|
||||||
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)
|
||||||
{
|
{
|
||||||
@@ -271,135 +268,6 @@ namespace Core.Cerberos.BFF.Api.Controllers
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <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> AddCompanyToUserService([FromBody] AddCompanyToUserRequest request, CancellationToken cancellationToken)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
logger.LogInformation($"{nameof(AddCompanyToUserService)} - Request received - Payload: {JsonSerializer.Serialize(request)}");
|
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(request.UserId)) { return BadRequest("Invalid user identifier"); }
|
|
||||||
if (string.IsNullOrEmpty(request.CompanyId)) { return BadRequest("Invalid company identifier"); }
|
|
||||||
|
|
||||||
return await Handle(() => cerberosServiceClient.AddCompanyToUserService(request, cancellationToken)).ConfigureAwait(false);
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
logger.LogError($"{nameof(AddCompanyToUserService)} - An Error Occurred- {ex.Message} - {ex.InnerException} - {ex.StackTrace} - with payload {JsonSerializer.Serialize(request)}");
|
|
||||||
throw;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <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> RemoveCompanyFromUserService([FromBody] RemoveCompanyFromUserRequest request, CancellationToken cancellationToken)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
logger.LogInformation($"{nameof(RemoveCompanyFromUserService)} - Request received - Payload: {JsonSerializer.Serialize(request)}");
|
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(request.UserId)) { return BadRequest("Invalid user identifier"); }
|
|
||||||
if (string.IsNullOrEmpty(request.CompanyId)) { return BadRequest("Invalid company identifier"); }
|
|
||||||
|
|
||||||
return await Handle(() => cerberosServiceClient.RemoveCompanyFromUserService(request, cancellationToken)).ConfigureAwait(false);
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
logger.LogError($"{nameof(RemoveCompanyFromUserService)} - An Error Occurred- {ex.Message} - {ex.InnerException} - {ex.StackTrace} - with payload {JsonSerializer.Serialize(request)}");
|
|
||||||
throw;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Adds a project to the user's list of companies.
|
|
||||||
/// </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> AddProjectToUserService([FromBody] AddProjectToUserRequest request, CancellationToken cancellationToken)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
logger.LogInformation($"{nameof(AddProjectToUserService)} - Request received - Payload: {JsonSerializer.Serialize(request)}");
|
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(request.UserId)) { return BadRequest("Invalid user identifier"); }
|
|
||||||
if (string.IsNullOrEmpty(request.ProjectId)) { return BadRequest("Invalid project identifier"); }
|
|
||||||
|
|
||||||
return await Handle(() => cerberosServiceClient.AddProjectToUserService(request, cancellationToken)).ConfigureAwait(false);
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
logger.LogError($"{nameof(AddProjectToUserService)} - An Error Occurred- {ex.Message} - {ex.InnerException} - {ex.StackTrace} - with payload {JsonSerializer.Serialize(request)}");
|
|
||||||
throw;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Removes a project from the user's list of companies.
|
|
||||||
/// </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> RemoveProjectFromUserService([FromBody] RemoveProjectFromUserRequest request, CancellationToken cancellationToken)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
logger.LogInformation($"{nameof(RemoveProjectFromUserService)} - Request received - Payload: {JsonSerializer.Serialize(request)}");
|
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(request.UserId)) { return BadRequest("Invalid user identifier"); }
|
|
||||||
if (string.IsNullOrEmpty(request.ProjectId)) { return BadRequest("Invalid project identifier"); }
|
|
||||||
|
|
||||||
return await Handle(() => cerberosServiceClient.RemoveProjectFromUserService(request, cancellationToken)).ConfigureAwait(false);
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
logger.LogError($"{nameof(RemoveProjectFromUserService)} - An Error Occurred- {ex.Message} - {ex.InnerException} - {ex.StackTrace} - with payload {JsonSerializer.Serialize(request)}");
|
|
||||||
throw;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the user by email.
|
/// Gets the user by email.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -419,7 +287,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)
|
||||||
{
|
{
|
||||||
@@ -8,7 +8,12 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\Core.Cerberos.External\Core.Cerberos.External.csproj" />
|
<PackageReference Include="Asp.Versioning.Mvc" Version="8.1.0" />
|
||||||
|
<PackageReference Include="Core.Blueprint.Logging" Version="1.0.1" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\Core.Thalos.External\Core.Thalos.External.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
6
Core.Thalos.BFF.Api/Core.Thalos.BFF.Api.http
Normal file
6
Core.Thalos.BFF.Api/Core.Thalos.BFF.Api.http
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
@Core.Thalos.BFF.Api_HostAddress = http://localhost:5219
|
||||||
|
|
||||||
|
GET {{Core.Thalos.BFF.Api_HostAddress}}/weatherforecast/
|
||||||
|
Accept: application/json
|
||||||
|
|
||||||
|
###
|
||||||
@@ -1,6 +1,9 @@
|
|||||||
using Core.Cerberos.Adapters.Extensions;
|
using Core.Blueprint.KeyVault.Configuration;
|
||||||
using Core.Cerberos.Adapters.Helpers;
|
using Core.Blueprint.Logging.Configuration;
|
||||||
using Core.Cerberos.External.ClientConfiguration;
|
using Core.Thalos.BuildingBlocks;
|
||||||
|
using Core.Thalos.BuildingBlocks.Configuration;
|
||||||
|
using Core.Thalos.BuildingBlocks.Extensions;
|
||||||
|
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,23 +12,28 @@ using System.Reflection;
|
|||||||
|
|
||||||
var builder = WebApplication.CreateBuilder(args);
|
var builder = WebApplication.CreateBuilder(args);
|
||||||
|
|
||||||
var authSettings = AuthHelper.GetAuthSettings(builder, "cerberos_bff");
|
|
||||||
|
|
||||||
builder.Services.ConfigureAuthentication(builder.Configuration, authSettings);
|
|
||||||
|
|
||||||
builder.Services.AddEndpointsApiExplorer();
|
|
||||||
builder.Configuration
|
builder.Configuration
|
||||||
.AddUserSecrets(Assembly.GetExecutingAssembly())
|
.AddUserSecrets(Assembly.GetExecutingAssembly())
|
||||||
.AddEnvironmentVariables();
|
.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.AddEndpointsApiExplorer();
|
||||||
|
|
||||||
|
|
||||||
builder.Services.AddResponseCompression();
|
builder.Services.AddResponseCompression();
|
||||||
builder.Services.AddProblemDetails();
|
builder.Services.AddProblemDetails();
|
||||||
|
builder.Services.AddLogs(builder);
|
||||||
builder.Services.AddMemoryCache();
|
builder.Services.AddMemoryCache();
|
||||||
builder.Services.AddResponseCaching(configureOptions => { configureOptions.UseCaseSensitivePaths = true; });
|
builder.Services.AddResponseCaching(configureOptions => { configureOptions.UseCaseSensitivePaths = true; });
|
||||||
builder.Logging.AddOpenTelemetry(options =>
|
builder.Logging.AddOpenTelemetry(options =>
|
||||||
{
|
{
|
||||||
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) =>
|
||||||
@@ -79,15 +87,13 @@ builder.Host.ConfigureServices((context, services) =>
|
|||||||
});
|
});
|
||||||
services.AddResponseCaching();
|
services.AddResponseCaching();
|
||||||
services.AddControllers();
|
services.AddControllers();
|
||||||
services.AddEndpointsApiExplorer();
|
services.AddSwaggerGen(builder.Configuration, "Core.Thalos.BFF.Api.xml", authSettings);
|
||||||
services.AddVersioning(builder.Configuration);
|
services.AddVersioning(builder.Configuration);
|
||||||
services.AddSwagger(builder.Configuration, "Core.Cerberos.BFF.API.xml", authSettings);
|
|
||||||
services.AddLogging();
|
services.AddLogging();
|
||||||
services.AddProblemDetails();
|
services.AddProblemDetails();
|
||||||
services.AddHttpContextAccessor();
|
services.AddHttpContextAccessor();
|
||||||
services.AddTransient<TrackingMechanismExtension>(); // Register the TrackingIdHandler
|
services.AddTransient<TrackingMechanismExtension>(); // Register the TrackingIdHandler
|
||||||
services.RegisterExternalLayer(builder.Configuration);
|
services.RegisterExternalLayer(builder.Configuration);
|
||||||
services.AddTelemetry();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
builder.Services.AddCors(options =>
|
builder.Services.AddCors(options =>
|
||||||
@@ -101,23 +107,37 @@ builder.Services.AddCors(options =>
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
builder.Services.AddScoped<ITokenService, TokenService>();
|
||||||
|
|
||||||
|
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();
|
var app = builder.Build();
|
||||||
|
app.UseLogging(builder.Configuration);
|
||||||
|
|
||||||
app.UseCors(options => options.AllowAnyHeader().AllowAnyMethod().AllowAnyOrigin());
|
|
||||||
app.UseSwagger();
|
|
||||||
app.UseSwaggerUI(builder.Configuration, authSettings);
|
app.UseSwaggerUI(builder.Configuration, authSettings);
|
||||||
app.ConfigureSwagger(builder.Configuration);
|
app.ConfigureSwagger(builder.Configuration);
|
||||||
app.UseResponseCompression();
|
|
||||||
app.UseResponseCaching();
|
|
||||||
|
app.UseRouting();
|
||||||
|
app.UseCors();
|
||||||
app.UseHttpsRedirection();
|
app.UseHttpsRedirection();
|
||||||
|
app.UseStaticFiles();
|
||||||
|
app.UseResponseCompression();
|
||||||
|
app.UseOutputCache();
|
||||||
|
app.UseResponseCaching();
|
||||||
|
|
||||||
app.UseAuthentication();
|
app.UseAuthentication();
|
||||||
app.UseAuthorization();
|
app.UseAuthorization();
|
||||||
|
|
||||||
app.MapControllers();
|
app.MapControllers();
|
||||||
app.UseHsts();
|
//app.MapHealthChecks("/health");
|
||||||
app.UseAntiforgery();
|
|
||||||
app.UseHttpLogging();
|
|
||||||
|
|
||||||
app.Run();
|
app.Run();
|
||||||
25
Core.Thalos.BFF.Api/appsettings.Local.json
Normal file
25
Core.Thalos.BFF.Api/appsettings.Local.json
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
{
|
||||||
|
"Logging": {
|
||||||
|
"LogLevel": {
|
||||||
|
"Default": "Information",
|
||||||
|
"Microsoft.AspNetCore": "Warning"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"LocalGateways": {
|
||||||
|
"ThalosService": "https://localhost:7253/api"
|
||||||
|
},
|
||||||
|
"ServiceSettings": {
|
||||||
|
"ApplicationName": "thalos",
|
||||||
|
"LayerName": "bff"
|
||||||
|
},
|
||||||
|
"Vault": {
|
||||||
|
"Address": "http://100.123.31.103:8200",
|
||||||
|
"Token": "hvs.e37LQvLuPhTd5ALS5QQ03Cwm",
|
||||||
|
"SecretMount": "secret"
|
||||||
|
},
|
||||||
|
"IdentityProviders": {
|
||||||
|
"Google": true,
|
||||||
|
"Azure": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -5,8 +5,5 @@
|
|||||||
"Microsoft.AspNetCore": "Warning"
|
"Microsoft.AspNetCore": "Warning"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"LocalGateways": {
|
"AllowedHosts": "*"
|
||||||
"CerberosService": "https://localhost:7253/api"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -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)
|
||||||
@@ -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
|
||||||
@@ -1,14 +1,12 @@
|
|||||||
using Core.Cerberos.Adapters.Contracts;
|
using Core.Thalos.BuildingBlocks;
|
||||||
using Core.Cerberos.Adapters.Handlers;
|
using Core.Thalos.External.GatewayConfigurations;
|
||||||
using Core.Cerberos.Adapters.TokenProvider;
|
|
||||||
using Core.Cerberos.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 +41,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 +53,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;
|
||||||
@@ -1,14 +1,15 @@
|
|||||||
using Core.Cerberos.Adapters;
|
using Core.Thalos.Application.UseCases.Roles.Input;
|
||||||
using Core.Cerberos.Application.UseCases.Roles.Input;
|
using Core.Thalos.Application.UseCases.Users.Input;
|
||||||
using Core.Cerberos.Application.UseCases.Users.Input;
|
using Core.Thalos.BuildingBlocks;
|
||||||
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.Tenants;
|
||||||
|
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);
|
||||||
@@ -31,6 +32,9 @@ namespace LSA.Dashboard.External.Clients.Dashboard
|
|||||||
[Put("/v1/User/Update")]
|
[Put("/v1/User/Update")]
|
||||||
Task<ApiResponse<UserAdapter>> UpdateUserService([Header("TrackingId")][Body] UpdateUserRequest request, CancellationToken cancellationToken = default);
|
Task<ApiResponse<UserAdapter>> UpdateUserService([Header("TrackingId")][Body] UpdateUserRequest request, CancellationToken cancellationToken = default);
|
||||||
|
|
||||||
|
[Delete("/v1/User/Delete")]
|
||||||
|
Task<ApiResponse<UserAdapter>> DeleteUserByIdService([Header("TrackingId")][Body] DeleteUserRequest request, CancellationToken cancellationToken = default);
|
||||||
|
|
||||||
[Patch("/v1/User/LoginUser")]
|
[Patch("/v1/User/LoginUser")]
|
||||||
Task<ApiResponse<UserAdapter>> LoginUserService([Header("TrackingId")][Body] LoginUserRequest request, CancellationToken cancellationToken = default);
|
Task<ApiResponse<UserAdapter>> LoginUserService([Header("TrackingId")][Body] LoginUserRequest request, CancellationToken cancellationToken = default);
|
||||||
|
|
||||||
@@ -40,18 +44,6 @@ namespace LSA.Dashboard.External.Clients.Dashboard
|
|||||||
[Patch("/v1/User/ChangeStatus")]
|
[Patch("/v1/User/ChangeStatus")]
|
||||||
Task<ApiResponse<UserAdapter>> ChangeUserStatusService([Header("TrackingId")][Body] ChangeUserStatusRequest request, CancellationToken cancellationToken = default);
|
Task<ApiResponse<UserAdapter>> ChangeUserStatusService([Header("TrackingId")][Body] ChangeUserStatusRequest request, CancellationToken cancellationToken = default);
|
||||||
|
|
||||||
[Post("/v1/User/AddCompany")]
|
|
||||||
Task<ApiResponse<UserAdapter>> AddCompanyToUserService([Header("TrackingId")][Body] AddCompanyToUserRequest request, CancellationToken cancellationToken = default);
|
|
||||||
|
|
||||||
[Delete("/v1/User/RemoveCompany")]
|
|
||||||
Task<ApiResponse<UserAdapter>> RemoveCompanyFromUserService([Header("TrackingId")][Body] RemoveCompanyFromUserRequest request, CancellationToken cancellationToken = default);
|
|
||||||
|
|
||||||
[Post("/v1/User/AddProject")]
|
|
||||||
Task<ApiResponse<UserAdapter>> AddProjectToUserService([Header("TrackingId")][Body] AddProjectToUserRequest request, CancellationToken cancellationToken = default);
|
|
||||||
|
|
||||||
[Delete("/v1/User/RemoveProject")]
|
|
||||||
Task<ApiResponse<UserAdapter>> RemoveProjectFromUserService([Header("TrackingId")][Body] RemoveProjectFromUserRequest request, CancellationToken cancellationToken = default);
|
|
||||||
|
|
||||||
[Post("/v1/User/GetTokenAdapter")]
|
[Post("/v1/User/GetTokenAdapter")]
|
||||||
Task<ApiResponse<TokenAdapter>> GetTokenAdapterService([Header("TrackingId")][Body] GetTokenAdapterRequest request, CancellationToken cancellationToken = default);
|
Task<ApiResponse<TokenAdapter>> GetTokenAdapterService([Header("TrackingId")][Body] GetTokenAdapterRequest request, CancellationToken cancellationToken = default);
|
||||||
|
|
||||||
@@ -73,6 +65,9 @@ namespace LSA.Dashboard.External.Clients.Dashboard
|
|||||||
[Patch("/v1/Role/ChangeStatus")]
|
[Patch("/v1/Role/ChangeStatus")]
|
||||||
Task<ApiResponse<RoleAdapter>> ChangeRoleStatusService([Header("TrackingId")][Body] ChangeRoleStatusRequest request, CancellationToken cancellationToken = default);
|
Task<ApiResponse<RoleAdapter>> ChangeRoleStatusService([Header("TrackingId")][Body] ChangeRoleStatusRequest request, CancellationToken cancellationToken = default);
|
||||||
|
|
||||||
|
[Delete("/v1/Role/Delete")]
|
||||||
|
Task<ApiResponse<RoleAdapter>> DeleteRoleByIdService([Header("TrackingId")][Body] DeleteRoleRequest request, CancellationToken cancellationToken = default);
|
||||||
|
|
||||||
[Post("/v1/Role/AddApplication")]
|
[Post("/v1/Role/AddApplication")]
|
||||||
Task<ApiResponse<RoleAdapter>> AddApplicationToRoleService([Header("TrackingId")][Body] AddApplicationToRoleRequest request, CancellationToken cancellationToken = default);
|
Task<ApiResponse<RoleAdapter>> AddApplicationToRoleService([Header("TrackingId")][Body] AddApplicationToRoleRequest request, CancellationToken cancellationToken = default);
|
||||||
|
|
||||||
@@ -97,6 +92,9 @@ namespace LSA.Dashboard.External.Clients.Dashboard
|
|||||||
[Patch("/v1/Permission/ChangeStatus")]
|
[Patch("/v1/Permission/ChangeStatus")]
|
||||||
Task<ApiResponse<PermissionAdapter>> ChangePermissionStatusService([Header("TrackingId")][Body] ChangePermissionStatusRequest request, CancellationToken cancellationToken = default);
|
Task<ApiResponse<PermissionAdapter>> ChangePermissionStatusService([Header("TrackingId")][Body] ChangePermissionStatusRequest request, CancellationToken cancellationToken = default);
|
||||||
|
|
||||||
|
[Delete("/v1/Permission/Delete")]
|
||||||
|
Task<ApiResponse<PermissionAdapter>> DeletePermissionByIdService([Header("TrackingId")][Body] DeletePermissionRequest request, CancellationToken cancellationToken = default);
|
||||||
|
|
||||||
[Post("/v1/Module/Create")]
|
[Post("/v1/Module/Create")]
|
||||||
Task<ApiResponse<ModuleAdapter>> CreateModuleService([Header("TrackingId")][Body] CreateModuleRequest request, CancellationToken cancellationToken = default);
|
Task<ApiResponse<ModuleAdapter>> CreateModuleService([Header("TrackingId")][Body] CreateModuleRequest request, CancellationToken cancellationToken = default);
|
||||||
|
|
||||||
@@ -114,5 +112,27 @@ namespace LSA.Dashboard.External.Clients.Dashboard
|
|||||||
|
|
||||||
[Patch("/v1/Module/ChangeStatus")]
|
[Patch("/v1/Module/ChangeStatus")]
|
||||||
Task<ApiResponse<ModuleAdapter>> ChangeModuleStatusService([Header("TrackingId")][Body] ChangeModuleStatusRequest request, CancellationToken cancellationToken = default);
|
Task<ApiResponse<ModuleAdapter>> ChangeModuleStatusService([Header("TrackingId")][Body] ChangeModuleStatusRequest request, CancellationToken cancellationToken = default);
|
||||||
|
|
||||||
|
[Delete("/v1/Module/Delete")]
|
||||||
|
Task<ApiResponse<ModuleAdapter>> DeleteModuleByIdService([Header("TrackingId")][Body] DeleteModuleRequest request, CancellationToken cancellationToken = default);
|
||||||
|
|
||||||
|
|
||||||
|
[Post("/v1/Tenant/Create")]
|
||||||
|
Task<ApiResponse<TenantAdapter>> CreateTenantService([Header("TrackingId")][Body] CreateTenantRequest request, CancellationToken cancellationToken = default);
|
||||||
|
|
||||||
|
[Post("/v1/Tenant/GetById")]
|
||||||
|
Task<ApiResponse<TenantAdapter>> GetTenantByIdService([Header("TrackingId")][Body] GetTenantRequest request, CancellationToken cancellationToken = default);
|
||||||
|
|
||||||
|
[Get("/v1/Tenant/GetAll")]
|
||||||
|
Task<ApiResponse<IEnumerable<TenantAdapter>>> GetAllTenantsService([Header("TrackingId")][Body] GetAllTenantsRequest request, CancellationToken cancellationToken = default);
|
||||||
|
|
||||||
|
[Put("/v1/Tenant/Update")]
|
||||||
|
Task<ApiResponse<TenantAdapter>> UpdateTenantService([Header("TrackingId")][Body] UpdateTenantRequest request, CancellationToken cancellationToken = default);
|
||||||
|
|
||||||
|
[Patch("/v1/Tenant/ChangeStatus")]
|
||||||
|
Task<ApiResponse<TenantAdapter>> ChangeTenantStatusService([Header("TrackingId")][Body] ChangeTenantStatusRequest request, CancellationToken cancellationToken = default);
|
||||||
|
|
||||||
|
[Delete("/v1/Tenant/Delete")]
|
||||||
|
Task<ApiResponse<UserAdapter>> DeleteTenantByIdService([Header("TrackingId")][Body] DeleteTenantRequest request, CancellationToken cancellationToken = default);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
using Core.Blueprint.Mongo;
|
||||||
|
|
||||||
|
namespace Core.Thalos.External.Clients.Thalos.Requests.Permissions
|
||||||
|
{
|
||||||
|
public class ChangeModuleStatusRequest
|
||||||
|
{
|
||||||
|
public string _Id { get; set; }
|
||||||
|
public StatusEnum Status { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
using Core.Cerberos.Adapters.Common.Enums;
|
using Core.Thalos.BuildingBlocks;
|
||||||
|
|
||||||
namespace Core.Cerberos.External.Clients.Cerberos.Requests.Permissions
|
namespace Core.Thalos.External.Clients.Thalos.Requests.Permissions
|
||||||
{
|
{
|
||||||
public class CreateModuleRequest
|
public class CreateModuleRequest
|
||||||
{
|
{
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
namespace Core.Thalos.External.Clients.Thalos.Requests.Permissions
|
||||||
|
{
|
||||||
|
public class DeleteModuleRequest
|
||||||
|
{
|
||||||
|
public string _Id { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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
|
||||||
{
|
{
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
namespace Core.Thalos.External.Clients.Thalos.Requests.Permissions
|
||||||
|
{
|
||||||
|
public class GetAllModulesRequest
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
namespace Core.Thalos.External.Clients.Thalos.Requests.Permissions
|
||||||
|
{
|
||||||
|
public class GetModuleRequest
|
||||||
|
{
|
||||||
|
public string _Id { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,10 +1,11 @@
|
|||||||
using Core.Cerberos.Adapters.Common.Enums;
|
using Core.Thalos.BuildingBlocks;
|
||||||
|
using StatusEnum = Core.Blueprint.Mongo.StatusEnum;
|
||||||
|
|
||||||
namespace Core.Cerberos.External.Clients.Cerberos.Requests.Permissions
|
namespace Core.Thalos.External.Clients.Thalos.Requests.Permissions
|
||||||
{
|
{
|
||||||
public class UpdateModuleRequest
|
public class UpdateModuleRequest
|
||||||
{
|
{
|
||||||
public string Id { get; set; } = null!;
|
public string _Id { get; set; } = null!;
|
||||||
public string Name { get; set; } = null!;
|
public string Name { get; set; } = null!;
|
||||||
public string? Description { get; set; }
|
public string? Description { get; set; }
|
||||||
public string? Icon { get; set; }
|
public string? Icon { get; set; }
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
using Core.Blueprint.Mongo;
|
||||||
|
|
||||||
|
namespace Core.Thalos.External.Clients.Thalos.Requests.Permissions
|
||||||
|
{
|
||||||
|
public class ChangePermissionStatusRequest
|
||||||
|
{
|
||||||
|
public string _Id { get; set; }
|
||||||
|
public StatusEnum Status { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
using Core.Cerberos.Adapters.Common.Constants;
|
using Core.Thalos.BuildingBlocks;
|
||||||
|
|
||||||
namespace Core.Cerberos.External.Clients.Cerberos.Requests.Permissions
|
namespace Core.Thalos.External.Clients.Thalos.Requests.Permissions
|
||||||
{
|
{
|
||||||
public class CreatePermissionRequest
|
public class CreatePermissionRequest
|
||||||
{
|
{
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
namespace Core.Thalos.External.Clients.Thalos.Requests.Permissions
|
||||||
|
{
|
||||||
|
public class DeletePermissionRequest
|
||||||
|
{
|
||||||
|
public string _Id { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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
|
||||||
{
|
{
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
namespace Core.Thalos.External.Clients.Thalos.Requests.Permissions
|
||||||
|
{
|
||||||
|
public class GetAllPermissionsRequest
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
namespace Core.Thalos.External.Clients.Thalos.Requests.Permissions
|
||||||
|
{
|
||||||
|
public class GetPermissionRequest
|
||||||
|
{
|
||||||
|
public string _Id { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,11 +1,11 @@
|
|||||||
using Core.Cerberos.Adapters.Common.Constants;
|
using Core.Thalos.BuildingBlocks;
|
||||||
using Core.Cerberos.Adapters.Common.Enums;
|
using StatusEnum = Core.Blueprint.Mongo.StatusEnum;
|
||||||
|
|
||||||
namespace Core.Cerberos.External.Clients.Cerberos.Requests.Permissions
|
namespace Core.Thalos.External.Clients.Thalos.Requests.Permissions
|
||||||
{
|
{
|
||||||
public class UpdatePermissionRequest
|
public class UpdatePermissionRequest
|
||||||
{
|
{
|
||||||
public string Id { get; set; } = null!;
|
public string _Id { get; set; } = null!;
|
||||||
public string Name { get; set; } = null!;
|
public string Name { get; set; } = null!;
|
||||||
public string? Description { get; set; }
|
public string? Description { get; set; }
|
||||||
public AccessLevelEnum? AccessLevel { get; set; } = null!;
|
public AccessLevelEnum? AccessLevel { get; set; } = null!;
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
using Core.Cerberos.Adapters.Common.Enums;
|
using Core.Thalos.BuildingBlocks;
|
||||||
|
|
||||||
namespace Core.Cerberos.Application.UseCases.Roles.Input
|
namespace Core.Thalos.Application.UseCases.Roles.Input
|
||||||
{
|
{
|
||||||
public class AddApplicationToRoleRequest
|
public class AddApplicationToRoleRequest
|
||||||
{
|
{
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
using Core.Blueprint.Mongo;
|
||||||
|
|
||||||
|
namespace Core.Thalos.Application.UseCases.Roles.Input
|
||||||
|
{
|
||||||
|
public class ChangeRoleStatusRequest
|
||||||
|
{
|
||||||
|
public string _Id { get; set; }
|
||||||
|
public StatusEnum Status { get; set; }
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
using Core.Cerberos.Adapters.Common.Enums;
|
using Core.Thalos.BuildingBlocks;
|
||||||
using System.Text.Json.Serialization;
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
namespace Core.Cerberos.Application.UseCases.Roles.Input
|
namespace Core.Thalos.Application.UseCases.Roles.Input
|
||||||
{
|
{
|
||||||
public class CreateRoleRequest
|
public class CreateRoleRequest
|
||||||
{
|
{
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
namespace Core.Thalos.Application.UseCases.Roles.Input
|
||||||
|
{
|
||||||
|
public class DeleteRoleRequest
|
||||||
|
{
|
||||||
|
public string _Id { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
namespace Core.Thalos.Application.UseCases.Roles.Input
|
||||||
|
{
|
||||||
|
public class GetAllRolesRequest
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
namespace Core.Thalos.Application.UseCases.Roles.Input
|
||||||
|
{
|
||||||
|
public class GetRoleRequest
|
||||||
|
{
|
||||||
|
public string _Id { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
using Core.Cerberos.Adapters.Common.Enums;
|
using Core.Thalos.BuildingBlocks;
|
||||||
|
|
||||||
namespace Core.Cerberos.Application.UseCases.Roles.Input
|
namespace Core.Thalos.Application.UseCases.Roles.Input
|
||||||
{
|
{
|
||||||
public class RemoveApplicationFromRoleRequest
|
public class RemoveApplicationFromRoleRequest
|
||||||
{
|
{
|
||||||
@@ -1,11 +1,12 @@
|
|||||||
using Core.Cerberos.Adapters.Common.Enums;
|
using Core.Thalos.BuildingBlocks;
|
||||||
using System.Text.Json.Serialization;
|
using System.Text.Json.Serialization;
|
||||||
|
using StatusEnum = Core.Blueprint.Mongo.StatusEnum;
|
||||||
|
|
||||||
namespace Core.Cerberos.Application.UseCases.Roles.Input
|
namespace Core.Thalos.Application.UseCases.Roles.Input
|
||||||
{
|
{
|
||||||
public class UpdateRoleRequest
|
public class UpdateRoleRequest
|
||||||
{
|
{
|
||||||
public string Id { get; set; } = null!;
|
public string _Id { get; set; } = null!;
|
||||||
public string Name { get; set; } = null!;
|
public string Name { get; set; } = null!;
|
||||||
public string? Description { get; set; }
|
public string? Description { get; set; }
|
||||||
[JsonConverter(typeof(EnumArrayJsonConverter<ApplicationsEnum>))]
|
[JsonConverter(typeof(EnumArrayJsonConverter<ApplicationsEnum>))]
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
using Core.Blueprint.Mongo;
|
||||||
|
|
||||||
|
namespace Core.Thalos.External.Clients.Thalos.Requests.Tenants
|
||||||
|
{
|
||||||
|
public class ChangeTenantStatusRequest
|
||||||
|
{
|
||||||
|
public string _Id { get; set; }
|
||||||
|
public StatusEnum Status { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
namespace Core.Thalos.External.Clients.Thalos.Requests.Tenants
|
||||||
|
{
|
||||||
|
public class CreateTenantRequest
|
||||||
|
{
|
||||||
|
public string Name { get; set; } = null!;
|
||||||
|
|
||||||
|
public string TaxIdentifier { get; set; } = null!;
|
||||||
|
|
||||||
|
public string AddressLine1 { get; set; } = null!;
|
||||||
|
|
||||||
|
public string? AddressLine2 { get; set; }
|
||||||
|
|
||||||
|
public string City { get; set; } = null!;
|
||||||
|
|
||||||
|
public string State { get; set; } = null!;
|
||||||
|
|
||||||
|
public string Country { get; set; } = null!;
|
||||||
|
|
||||||
|
public string PostalCode { get; set; } = null!;
|
||||||
|
|
||||||
|
public string ContactEmail { get; set; } = null!;
|
||||||
|
|
||||||
|
public string ContactPhone { get; set; } = null!;
|
||||||
|
|
||||||
|
public string? Website { get; set; }
|
||||||
|
|
||||||
|
public string? ConnectionString { get; set; }
|
||||||
|
|
||||||
|
public bool Isolated { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
namespace Core.Thalos.External.Clients.Thalos.Requests.Tenants
|
||||||
|
{
|
||||||
|
public class DeleteTenantRequest
|
||||||
|
{
|
||||||
|
public string _Id { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
namespace Core.Thalos.External.Clients.Thalos.Requests.Tenants
|
||||||
|
{
|
||||||
|
public class GetAllTenantsRequest
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
namespace Core.Thalos.External.Clients.Thalos.Requests.Tenants
|
||||||
|
{
|
||||||
|
public class GetTenantRequest
|
||||||
|
{
|
||||||
|
public string _Id { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
namespace Core.Thalos.External.Clients.Thalos.Requests.Tenants
|
||||||
|
{
|
||||||
|
public class UpdateTenantRequest
|
||||||
|
{
|
||||||
|
public string Name { get; set; } = null!;
|
||||||
|
|
||||||
|
public string TaxIdentifier { get; set; } = null!;
|
||||||
|
|
||||||
|
public string AddressLine1 { get; set; } = null!;
|
||||||
|
|
||||||
|
public string? AddressLine2 { get; set; }
|
||||||
|
|
||||||
|
public string City { get; set; } = null!;
|
||||||
|
|
||||||
|
public string State { get; set; } = null!;
|
||||||
|
|
||||||
|
public string Country { get; set; } = null!;
|
||||||
|
|
||||||
|
public string PostalCode { get; set; } = null!;
|
||||||
|
|
||||||
|
public string ContactEmail { get; set; } = null!;
|
||||||
|
|
||||||
|
public string ContactPhone { get; set; } = null!;
|
||||||
|
|
||||||
|
public string? Website { get; set; }
|
||||||
|
|
||||||
|
public string? ConnectionString { get; set; }
|
||||||
|
|
||||||
|
public bool Isolated { get; set; }
|
||||||
|
public string _Id { get; set; } = null!;
|
||||||
|
public string Id { get; init; } = null!;
|
||||||
|
public DateTime CreatedAt { get; set; }
|
||||||
|
public string? CreatedBy { get; set; }
|
||||||
|
public DateTime? UpdatedAt { get; set; }
|
||||||
|
public string? UpdatedBy { get; set; }
|
||||||
|
|
||||||
|
public Blueprint.Mongo.StatusEnum Status { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
using Core.Blueprint.Mongo;
|
||||||
|
|
||||||
|
namespace Core.Thalos.Application.UseCases.Users.Input
|
||||||
|
{
|
||||||
|
public class ChangeUserStatusRequest
|
||||||
|
{
|
||||||
|
public string _Id { get; set; }
|
||||||
|
public StatusEnum Status { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
namespace Core.Cerberos.Application.UseCases.Users.Input
|
namespace Core.Thalos.Application.UseCases.Users.Input
|
||||||
{
|
{
|
||||||
public class CreateUserRequest
|
public class CreateUserRequest
|
||||||
{
|
{
|
||||||
@@ -7,8 +7,6 @@
|
|||||||
public string? MiddleName { get; set; }
|
public string? MiddleName { get; set; }
|
||||||
public string LastName { get; set; } = null!;
|
public string LastName { get; set; } = null!;
|
||||||
public string RoleId { get; set; } = null!;
|
public string RoleId { get; set; } = null!;
|
||||||
public string[] Companies { get; set; } = null!;
|
|
||||||
public string[]? Projects { get; set; }
|
|
||||||
public bool SendInvitation { get; set; }
|
public bool SendInvitation { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
namespace Core.Thalos.Application.UseCases.Users.Input
|
||||||
|
{
|
||||||
|
public class DeleteUserRequest
|
||||||
|
{
|
||||||
|
public string _Id { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
namespace Core.Thalos.Application.UseCases.Users.Input
|
||||||
|
{
|
||||||
|
public class GetAllUsersRequest
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
namespace Core.Cerberos.Application.UseCases.Users.Input
|
namespace Core.Thalos.Application.UseCases.Users.Input
|
||||||
{
|
{
|
||||||
public class GetUserByEmailRequest
|
public class GetUserByEmailRequest
|
||||||
{
|
{
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
namespace Core.Cerberos.Application.UseCases.Users.Input
|
namespace Core.Thalos.Application.UseCases.Users.Input
|
||||||
{
|
{
|
||||||
public class GetTokenAdapterRequest
|
public class GetTokenAdapterRequest
|
||||||
{
|
{
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
namespace Core.Thalos.Application.UseCases.Users.Input
|
||||||
|
{
|
||||||
|
public class GetUserRequest
|
||||||
|
{
|
||||||
|
public string _Id { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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
|
||||||
{
|
{
|
||||||
@@ -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
|
||||||
{
|
{
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
using Core.Cerberos.Adapters.Common.Enums;
|
using Core.Blueprint.Mongo;
|
||||||
|
|
||||||
namespace Core.Cerberos.Application.UseCases.Users.Input
|
namespace Core.Thalos.Application.UseCases.Users.Input
|
||||||
{
|
{
|
||||||
public class UpdateUserRequest
|
public class UpdateUserRequest
|
||||||
{
|
{
|
||||||
public string Id { get; set; } = null!;
|
public string _Id { get; set; } = null!;
|
||||||
public string Email { get; set; } = null!;
|
public string Email { get; set; } = null!;
|
||||||
public string Name { get; set; } = null!;
|
public string Name { get; set; } = null!;
|
||||||
public string? MiddleName { get; set; }
|
public string? MiddleName { get; set; }
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
namespace Core.Cerberos.Application.UseCases.Users.Input
|
namespace Core.Thalos.Application.UseCases.Users.Input
|
||||||
{
|
{
|
||||||
public class ValidateUserExistenceRequest
|
public class ValidateUserExistenceRequest
|
||||||
{
|
{
|
||||||
@@ -7,8 +7,8 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="BuildingBlocks.Library" Version="0.0.1" />
|
<PackageReference Include="Core.Thalos.BuildingBlocks" Version="1.1.4" />
|
||||||
<PackageReference Include="Cerberos.Building.Blocks" Version="0.0.3" />
|
<PackageReference Include="Lib.Architecture.BuildingBlocks" Version="1.0.0" />
|
||||||
<PackageReference Include="Refit" Version="8.0.0" />
|
<PackageReference Include="Refit" Version="8.0.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
@@ -1,17 +1,17 @@
|
|||||||
using Core.Blueprint.External;
|
using Core.Blueprint.External;
|
||||||
|
|
||||||
namespace Core.Cerberos.External.GatewayConfigurations
|
namespace Core.Thalos.External.GatewayConfigurations
|
||||||
{
|
{
|
||||||
public record GatewayConfiguration
|
public record GatewayConfiguration
|
||||||
{
|
{
|
||||||
public GatewayConfiguration()
|
public GatewayConfiguration()
|
||||||
{
|
{
|
||||||
CerberosService = new CerberosServiceAPI();
|
ThalosService = new ThalosServiceAPI();
|
||||||
}
|
}
|
||||||
|
|
||||||
public CerberosServiceAPI CerberosService { get; set; }
|
public ThalosServiceAPI ThalosService { get; set; }
|
||||||
}
|
}
|
||||||
public record CerberosServiceAPI
|
public record ThalosServiceAPI
|
||||||
{
|
{
|
||||||
public string Channel { get; set; }
|
public string Channel { get; set; }
|
||||||
public BaseEndpoint Endpoint { get; set; }
|
public BaseEndpoint Endpoint { get; set; }
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
using Core.Blueprint.External;
|
using Core.Blueprint.External;
|
||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
|
|
||||||
namespace Core.Cerberos.External.GatewayConfigurations
|
namespace Core.Thalos.External.GatewayConfigurations
|
||||||
{
|
{
|
||||||
public class GatewaySettingsConfigurations
|
public class GatewaySettingsConfigurations
|
||||||
{
|
{
|
||||||
@@ -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"
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -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
|
||||||
{
|
{
|
||||||
Reference in New Issue
Block a user