feat: add local authentication

This commit is contained in:
xiong
2026-07-26 12:51:56 +08:00
parent e8b03c57bc
commit 2b02bbef7b
21 changed files with 1014 additions and 15 deletions

View File

@@ -0,0 +1,56 @@
using Tiku.Domain.Tenancy;
namespace Tiku.Application.Auth;
public sealed record AuthTokenPair(
string AccessToken,
string RefreshToken,
DateTimeOffset AccessTokenExpiresAt,
DateTimeOffset RefreshTokenExpiresAt);
public sealed record TenantMembershipSummary(
Guid TenantId,
string TenantName,
TenantRole Role,
MembershipStatus Status);
public sealed record AuthenticatedUser(
Guid UserId,
string? Phone,
string? Email,
string? Name,
TenantMembershipSummary Tenant,
AuthTokenPair Tokens);
public sealed record PasswordLoginRequest(
Guid TenantId,
string Phone,
string Password,
string? IpAddress,
string? UserAgent);
public sealed record SmsLoginRequest(
Guid TenantId,
string Phone,
string Code,
string? IpAddress,
string? UserAgent);
public sealed record RefreshSessionRequest(
string RefreshToken,
string? IpAddress,
string? UserAgent);
public sealed record LogoutSessionRequest(
string RefreshToken);
public sealed record SmsSendResult(
Guid VerificationId,
DateTimeOffset ExpiresAt);
public sealed record SendSmsCodeRequest(
Guid TenantId,
string Phone,
SmsPurpose Purpose,
string? IpAddress,
string? UserAgent);