mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-10-14 21:22:49 +00:00
Fix SessionCache.ini (Mojang now uses JWT)
Session IDs from Mojang are now JWT instead of UUID
This commit is contained in:
parent
7dafee8b13
commit
2e52bdea39
1 changed files with 4 additions and 1 deletions
|
|
@ -1,5 +1,6 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.IO;
|
||||
|
||||
namespace MinecraftClient.Protocol.Session
|
||||
|
|
@ -7,6 +8,8 @@ namespace MinecraftClient.Protocol.Session
|
|||
[Serializable]
|
||||
public class SessionToken
|
||||
{
|
||||
private static readonly Regex JwtRegex = new Regex("^[A-Za-z0-9-_]+\\.[A-Za-z0-9-_]+\\.[A-Za-z0-9-_]+$");
|
||||
|
||||
public string ID { get; set; }
|
||||
public string PlayerName { get; set; }
|
||||
public string PlayerID { get; set; }
|
||||
|
|
@ -38,7 +41,7 @@ namespace MinecraftClient.Protocol.Session
|
|||
session.ClientID = fields[3];
|
||||
|
||||
Guid temp;
|
||||
if (!Guid.TryParseExact(session.ID, "N", out temp))
|
||||
if (!JwtRegex.IsMatch(session.ID))
|
||||
throw new InvalidDataException("Invalid session ID");
|
||||
if (!ChatBot.IsValidName(session.PlayerName))
|
||||
throw new InvalidDataException("Invalid player name");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue