First Commit
This commit is contained in:
@@ -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);
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
using ADS.Helpers.Auth.Models;
|
||||
|
||||
namespace ADS.Helpers.Auth.Abstractions;
|
||||
|
||||
public interface IAdsPrincipalAccessor
|
||||
{
|
||||
AdsPrincipal Current { get; }
|
||||
bool IsAuthenticated { get; }
|
||||
}
|
||||
13
Helpers/ADS.Helpers.Auth/Abstractions/IAdsTokenService.cs
Normal file
13
Helpers/ADS.Helpers.Auth/Abstractions/IAdsTokenService.cs
Normal 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);
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
Reference in New Issue
Block a user