using MPKey = MessagePack.KeyAttribute; using MPObj = MessagePack.MessagePackObjectAttribute; using N_JsonProperty = Newtonsoft.Json.JsonPropertyAttribute; using S_JsonProperty = System.Text.Json.Serialization.JsonPropertyNameAttribute; namespace System.Application.Models { /// /// JWT 值 /// [MPObj] [Serializable] public sealed class JWTEntity : IExplicitHasValue { /// /// 凭证有效期 /// [MPKey(0)] [N_JsonProperty("0")] [S_JsonProperty("0")] public DateTimeOffset ExpiresIn { get; set; } /// /// 当前凭证 /// [MPKey(1)] [N_JsonProperty("1")] [S_JsonProperty("1")] public string? AccessToken { get; set; } /// /// 刷新凭证 /// [MPKey(2)] [N_JsonProperty("2")] [S_JsonProperty("2")] public string? RefreshToken { get; set; } bool IExplicitHasValue.ExplicitHasValue() { return !string.IsNullOrEmpty(AccessToken) && !string.IsNullOrEmpty(RefreshToken); } } }