- add: Auth service
This commit is contained in:
10
Nebula.Launcher/Models/Auth/AuthenticateRequest.cs
Normal file
10
Nebula.Launcher/Models/Auth/AuthenticateRequest.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
using System;
|
||||
|
||||
namespace Nebula.Launcher.Models.Auth;
|
||||
|
||||
public sealed record AuthenticateRequest(string? Username, Guid? UserId, string Password, string? TfaCode = null)
|
||||
{
|
||||
public AuthenticateRequest(string username, string password) : this(username, null, password)
|
||||
{
|
||||
}
|
||||
}
|
||||
5
Nebula.Launcher/Models/Auth/AuthenticateResponse.cs
Normal file
5
Nebula.Launcher/Models/Auth/AuthenticateResponse.cs
Normal file
@@ -0,0 +1,5 @@
|
||||
using System;
|
||||
|
||||
namespace Nebula.Launcher.Models.Auth;
|
||||
|
||||
public sealed record AuthenticateResponse(string Token, string Username, Guid UserId, DateTimeOffset ExpireTime);
|
||||
15
Nebula.Launcher/Models/Auth/LoginInfo.cs
Normal file
15
Nebula.Launcher/Models/Auth/LoginInfo.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using System;
|
||||
|
||||
namespace Nebula.Launcher.Models.Auth;
|
||||
|
||||
public class LoginInfo
|
||||
{
|
||||
public Guid UserId { get; set; }
|
||||
public string Username { get; set; } = default!;
|
||||
public LoginToken Token { get; set; }
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"{Username}/{UserId}";
|
||||
}
|
||||
}
|
||||
15
Nebula.Launcher/Models/Auth/LoginToken.cs
Normal file
15
Nebula.Launcher/Models/Auth/LoginToken.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using System;
|
||||
|
||||
namespace Nebula.Launcher.Models.Auth;
|
||||
|
||||
public readonly struct LoginToken
|
||||
{
|
||||
public readonly string Token;
|
||||
public readonly DateTimeOffset ExpireTime;
|
||||
|
||||
public LoginToken(string token, DateTimeOffset expireTime)
|
||||
{
|
||||
Token = token;
|
||||
ExpireTime = expireTime;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user