Add JWT auth, token service & Neutrino endpoint

This commit is contained in:
Holden
2026-06-19 12:25:45 -05:00
parent 608def3ac8
commit 3eebfc9ba2
27 changed files with 581 additions and 51 deletions

View File

@@ -0,0 +1,28 @@
using System.Text.Json.Serialization;
using API.Contracts.Neutrino.Enums;
namespace API.Contracts.Neutrino.Responses;
// {"ResultCode":1,"UserId":"their user id","Nickname":"splotybean"}
public class NeutrinoAuthenticateResponse : NeutrinoResultCodeResponse
{
public static NeutrinoAuthenticateResponse Success(string userId, string nickname) => new()
{
ResultCode = (byte)AuthenticationResultCode.AuthenticationSuccessful,
UserId = userId,
Nickname = nickname
};
public static NeutrinoAuthenticateResponse Failure(AuthenticationResultCode error) => new()
{
ResultCode = (byte)error
};
[JsonPropertyName(name: "UserId")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? UserId { get; set; }
[JsonPropertyName(name: "Nickname")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? Nickname { get; set; }
}