First Commit

This commit is contained in:
Jorge Luis caudillo esparza
2026-05-09 16:36:57 -07:00
parent 96ad4c0d3e
commit d0c284d9c0
131 changed files with 4009 additions and 0 deletions

View File

@@ -0,0 +1,29 @@
using ADS.Helpers.Auth.Abstractions;
using ADS.Helpers.Auth.Token;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
[ApiController]
[Route("auth")]
public class AuthController : ControllerBase
{
private readonly IAdsTokenService _tokenService;
public AuthController(
IAdsTokenService tokenService )
{
_tokenService = tokenService;
}
[HttpPost("token")]
[AllowAnonymous]
public async Task<IActionResult> Token(
[FromBody] AdsTokenRequest request,
CancellationToken ct)
{
var token = await _tokenService.IssueAsync(request,ct);
return Ok(token);
}
}

View File

@@ -0,0 +1,36 @@
using ADS.Helpers.Auth.Abstractions;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
namespace ADS.Host.Controllers;
[ApiController]
[Route("api/[controller]")]
public sealed class WhoAmIController : ControllerBase
{
private readonly IAdsPrincipalAccessor _principal;
public WhoAmIController(IAdsPrincipalAccessor principal)
{
_principal = principal;
}
[HttpGet]
[Authorize]
public IActionResult Get()
{
var me = _principal.Current;
return Ok(new
{
me.CveUser,
me.TenantId,
me.UserName,
me.CveRole,
me.CveEmpresa,
me.CveCliente,
me.CveModulos,
me.Permissions
});
}
}