using System.IdentityModel.Tokens.Jwt; using Fantasy; namespace Hotfix; public static class GateJwtComponentHelper { private static bool ValidateToken(Scene scene, string token,out JwtPayload payload) { return scene.GetComponent().ValidateToken(token, out payload); } public static bool ValidateToken(Scene scene, string token, out long accountId) { accountId = 0; if (!ValidateToken(scene, token, out JwtPayload payload)) { return false; } try { var sceneConfigId = Convert.ToInt64(payload["sceneId"]); accountId = Convert.ToInt64(payload["aid"]); if (sceneConfigId == scene.SceneConfigId) { return false; } return true; } catch (Exception e) { Console.WriteLine(e); throw; } } }