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,27 @@
using System.Collections.Generic;
using System.Security.Claims;
using System.Threading;
using System.Threading.Tasks;
namespace ADS.Helpers.Auth.Abstractions;
public sealed class AdsClientValidationResult
{
public bool IsValid { get; set; }
public string ClientId { get; set; } = default!;
public string? TenantId { get; set; }
public List<Claim> ExtraClaims { get; set; } = new();
public string? Error { get; set; }
}
public interface IAdsClientCredentialValidator
{
Task<AdsClientValidationResult> ValidateAsync(
string clientId,
string clientSecret,
string? tenantId,
string? scope,
CancellationToken ct = default);
}

View File

@@ -0,0 +1,9 @@
using ADS.Helpers.Auth.Models;
namespace ADS.Helpers.Auth.Abstractions;
public interface IAdsPrincipalAccessor
{
AdsPrincipal Current { get; }
bool IsAuthenticated { get; }
}

View File

@@ -0,0 +1,13 @@
using ADS.Helpers.Auth.Token;
using System.Security.Claims;
using System.Threading;
using System.Threading.Tasks;
namespace ADS.Helpers.Auth.Abstractions;
public interface IAdsTokenService
{
Task<AdsTokenResult> IssueAsync(AdsTokenRequest request, CancellationToken ct = default);
Task<AdsTokenResult> IssueFromClaimsAsync(IReadOnlyCollection<Claim> claims, string? scope = null, CancellationToken ct = default);
}

View File

@@ -0,0 +1,37 @@
using System.Collections.Generic;
using System.Security.Claims;
using System.Threading;
using System.Threading.Tasks;
namespace ADS.Helpers.Auth.Abstractions;
public sealed class AdsUserValidationResult
{
public bool IsValid { get; set; }
public int CveUser { get; set; }
public string? UserName { get; set; }
public int CveRole { get; set; }
public int CveEmpresa { get; set; }
public int CveCliente { get; set; }
public int[] CveModulos { get; set; } = [];
public string[] Permissions { get; set; } = [];
public List<Claim> ExtraClaims { get; set; } = new();
public string? Error { get; set; }
public string? TenantId { get; set; }
}
public interface IAdsUserCredentialValidator
{
Task<AdsUserValidationResult> ValidateAsync(
string userName,
string password,
string? tenantId,
string? scope,
CancellationToken ct = default);
}