using Femto.Modules.Auth.Application.Dto; using Femto.Modules.Auth.Models; namespace Femto.Modules.Auth.Application; /// /// I broke off IAuthService from IAuthModule because the CQRS distinction is cumbersome when doing auth handling, /// particularly in regards to session management. I may or may not bother to move the commands and queries here also, /// but for controller actions I do quite like having the abstraction, and there is less drive within me to bother. /// It just seems redundant to expose them both, and it's a bit confusin' /// public interface IAuthService { public Task AuthenticateUserCredentials( string username, string password, CancellationToken cancellationToken = default ); public Task GetUserWithId( Guid? userId, CancellationToken cancellationToken = default ); public Task CreateNewSession(Guid userId); public Task CreateWeakSession(Guid userId); public Task GetSession(string sessionId); public Task DeleteSession(string sessionId); public Task CreateUserWithCredentials(string username, string password, string signupCode, CancellationToken cancellationToken = default); public Task AddSignupCode( string code, string recipientName, CancellationToken cancellationToken = default ); public Task> GetSignupCodes( CancellationToken cancellationToken = default ); Task CreateRememberMeToken(Guid userId); Task<(UserInfo?, NewRememberMeToken?)> GetUserWithRememberMeToken(RememberMeToken rememberMeToken); Task DeleteRememberMeToken(RememberMeToken rememberMeToken); } public record UserAndSession(UserInfo User, Session Session);