shoc-backend/SeaHaven.DataServices/Interfaces/IUserDataService.cs
Alexandre Brandizzi b7be07411e fix(auth): end earlier sessions when a password or account status changes
Tokens now carry a keyed hash of the account's security stamp, and every
authenticated request compares it with the stored stamp (cached for 60 s,
evicted in-process on change). A password reset or change, a deactivation
and a deletion all rotate or remove the stamp, so tokens issued before them
get 401. Tokens without the claim get 401 too.
2026-09-25 19:08:33 -03:00

28 lines
1.7 KiB
C#

using Data.SeaHavenIndustries;
using SeaHaven.DataServices.Dto;
namespace SeaHaven.DataServices.Interfaces
{
public interface IUserDataService
{
Task<ApplicationUser?> GetByIdAsync(string id);
Task<IEnumerable<ApplicationUser>> GetAllAsync();
Task<ApplicationUser?> GetByEmailAsync(string email);
Task<bool> ExistsAsync(string id);
Task<IReadOnlyList<UserListRowData>> GetAllForListAsync(CancellationToken cancellationToken);
Task<UserProfileData?> GetProfileAsync(string id, CancellationToken cancellationToken);
Task<bool> UpdateProfileAsync(string id, string? name, string? email, string? contact, CancellationToken cancellationToken);
Task<ApplicationUser?> GetForEditAsync(string id, CancellationToken cancellationToken);
Task<bool> IsAccountOwnerAsync(string userId, CancellationToken cancellationToken);
Task<ApplicationUser?> GetByEmailNormalizedAsync(string email, CancellationToken cancellationToken);
Task UpdateUserAsync(ApplicationUser user, CancellationToken cancellationToken);
Task DeleteUserWithCascadeAsync(ApplicationUser user, CancellationToken cancellationToken);
Task ExecuteTransactionalAsync(Func<CancellationToken, Task> callback, CancellationToken cancellationToken);
Task<string?> GetEmailByIdAsync(string userId, CancellationToken cancellationToken);
/// <summary>The security stamp of an account that exists and is not deleted; otherwise null.</summary>
Task<string?> GetActiveSecurityStampAsync(string userId, CancellationToken cancellationToken);
Task<IReadOnlyDictionary<string, string>> GetDisplayNamesByIdsAsync(IEnumerable<string> ids);
}
}