48 lines
No EOL
1.8 KiB
C#
48 lines
No EOL
1.8 KiB
C#
using Femto.Modules.Auth.Application.Dto;
|
|
using Femto.Modules.Auth.Models;
|
|
|
|
namespace Femto.Modules.Auth.Application;
|
|
|
|
/// <summary>
|
|
/// 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'
|
|
/// </summary>
|
|
public interface IAuthService
|
|
{
|
|
public Task<UserAndSession?> AuthenticateUserCredentials(
|
|
string username,
|
|
string password,
|
|
CancellationToken cancellationToken = default
|
|
);
|
|
public Task<UserInfo?> GetUserWithId(
|
|
Guid? userId,
|
|
CancellationToken cancellationToken = default
|
|
);
|
|
public Task<Session> CreateNewSession(Guid userId);
|
|
public Task<Session> CreateWeakSession(Guid userId);
|
|
public Task<Session?> GetSession(string sessionId);
|
|
public Task DeleteSession(string sessionId);
|
|
|
|
public Task<UserAndSession> CreateUserWithCredentials(string username,
|
|
string password,
|
|
string signupCode,
|
|
CancellationToken cancellationToken = default);
|
|
|
|
public Task AddSignupCode(
|
|
string code,
|
|
string recipientName,
|
|
CancellationToken cancellationToken = default
|
|
);
|
|
|
|
public Task<ICollection<SignupCodeDto>> GetSignupCodes(
|
|
CancellationToken cancellationToken = default
|
|
);
|
|
|
|
Task<NewRememberMeToken> CreateRememberMeToken(Guid userId);
|
|
Task<(UserInfo?, NewRememberMeToken?)> GetUserWithRememberMeToken(RememberMeToken rememberMeToken);
|
|
Task DeleteRememberMeToken(RememberMeToken rememberMeToken);
|
|
}
|
|
|
|
public record UserAndSession(UserInfo User, Session Session); |