mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-10-17 04:06:54 +00:00
Update BedrockProtocol
This commit is contained in:
@@ -27,8 +27,8 @@ use pocketmine\lang\KnownTranslationFactory;
|
||||
use pocketmine\lang\Translatable;
|
||||
use pocketmine\network\mcpe\JwtException;
|
||||
use pocketmine\network\mcpe\JwtUtils;
|
||||
use pocketmine\network\mcpe\protocol\types\login\JwtChainLinkBody;
|
||||
use pocketmine\network\mcpe\protocol\types\login\JwtHeader;
|
||||
use pocketmine\network\mcpe\protocol\types\login\legacy\LegacyAuthJwtBody;
|
||||
use pocketmine\network\mcpe\protocol\types\login\SelfSignedJwtHeader;
|
||||
use pocketmine\scheduler\AsyncTask;
|
||||
use pocketmine\thread\NonThreadSafeValue;
|
||||
use function base64_decode;
|
||||
@@ -128,8 +128,8 @@ class ProcessLoginTask extends AsyncTask{
|
||||
$mapper->bEnforceMapType = false;
|
||||
|
||||
try{
|
||||
/** @var JwtHeader $headers */
|
||||
$headers = $mapper->map($headersArray, new JwtHeader());
|
||||
/** @var SelfSignedJwtHeader $headers */
|
||||
$headers = $mapper->map($headersArray, new SelfSignedJwtHeader());
|
||||
}catch(\JsonMapper_Exception $e){
|
||||
throw new VerifyLoginException("Invalid JWT header: " . $e->getMessage(), null, 0, $e);
|
||||
}
|
||||
@@ -172,8 +172,8 @@ class ProcessLoginTask extends AsyncTask{
|
||||
$mapper->bEnforceMapType = false;
|
||||
$mapper->bRemoveUndefinedAttributes = true;
|
||||
try{
|
||||
/** @var JwtChainLinkBody $claims */
|
||||
$claims = $mapper->map($claimsArray, new JwtChainLinkBody());
|
||||
/** @var LegacyAuthJwtBody $claims */
|
||||
$claims = $mapper->map($claimsArray, new LegacyAuthJwtBody());
|
||||
}catch(\JsonMapper_Exception $e){
|
||||
throw new VerifyLoginException("Invalid chain link body: " . $e->getMessage(), null, 0, $e);
|
||||
}
|
||||
|
@@ -32,12 +32,12 @@ use pocketmine\network\mcpe\JwtException;
|
||||
use pocketmine\network\mcpe\JwtUtils;
|
||||
use pocketmine\network\mcpe\NetworkSession;
|
||||
use pocketmine\network\mcpe\protocol\LoginPacket;
|
||||
use pocketmine\network\mcpe\protocol\types\login\AuthenticationData;
|
||||
use pocketmine\network\mcpe\protocol\types\login\AuthenticationInfo;
|
||||
use pocketmine\network\mcpe\protocol\types\login\AuthenticationType;
|
||||
use pocketmine\network\mcpe\protocol\types\login\ClientData;
|
||||
use pocketmine\network\mcpe\protocol\types\login\ClientDataToSkinDataHelper;
|
||||
use pocketmine\network\mcpe\protocol\types\login\JwtChain;
|
||||
use pocketmine\network\mcpe\protocol\types\login\clientdata\ClientData;
|
||||
use pocketmine\network\mcpe\protocol\types\login\clientdata\ClientDataToSkinDataHelper;
|
||||
use pocketmine\network\mcpe\protocol\types\login\legacy\LegacyAuthChain;
|
||||
use pocketmine\network\mcpe\protocol\types\login\legacy\LegacyAuthIdentityData;
|
||||
use pocketmine\network\PacketHandlingException;
|
||||
use pocketmine\player\Player;
|
||||
use pocketmine\player\PlayerInfo;
|
||||
@@ -180,7 +180,7 @@ class LoginPacketHandler extends PacketHandler{
|
||||
/**
|
||||
* @throws PacketHandlingException
|
||||
*/
|
||||
protected function parseJwtChain(string $chainDataJwt) : JwtChain{
|
||||
protected function parseJwtChain(string $chainDataJwt) : LegacyAuthChain{
|
||||
try{
|
||||
$jwtChainJson = json_decode($chainDataJwt, associative: false, flags: JSON_THROW_ON_ERROR);
|
||||
}catch(\JsonException $e){
|
||||
@@ -195,7 +195,7 @@ class LoginPacketHandler extends PacketHandler{
|
||||
$mapper->bExceptionOnUndefinedProperty = true;
|
||||
$mapper->bStrictObjectTypeChecking = true;
|
||||
try{
|
||||
$clientData = $mapper->map($jwtChainJson, new JwtChain());
|
||||
$clientData = $mapper->map($jwtChainJson, new LegacyAuthChain());
|
||||
}catch(\JsonMapper_Exception $e){
|
||||
throw PacketHandlingException::wrap($e);
|
||||
}
|
||||
@@ -205,8 +205,8 @@ class LoginPacketHandler extends PacketHandler{
|
||||
/**
|
||||
* @throws PacketHandlingException
|
||||
*/
|
||||
protected function fetchAuthData(JwtChain $chain) : AuthenticationData{
|
||||
/** @var AuthenticationData|null $extraData */
|
||||
protected function fetchAuthData(LegacyAuthChain $chain) : LegacyAuthIdentityData{
|
||||
/** @var LegacyAuthIdentityData|null $extraData */
|
||||
$extraData = null;
|
||||
foreach($chain->chain as $jwt){
|
||||
//validate every chain element
|
||||
@@ -229,8 +229,8 @@ class LoginPacketHandler extends PacketHandler{
|
||||
$mapper->bExceptionOnUndefinedProperty = true;
|
||||
$mapper->bStrictObjectTypeChecking = true;
|
||||
try{
|
||||
/** @var AuthenticationData $extraData */
|
||||
$extraData = $mapper->map($claims["extraData"], new AuthenticationData());
|
||||
/** @var LegacyAuthIdentityData $extraData */
|
||||
$extraData = $mapper->map($claims["extraData"], new LegacyAuthIdentityData());
|
||||
}catch(\JsonMapper_Exception $e){
|
||||
throw PacketHandlingException::wrap($e);
|
||||
}
|
||||
|
Reference in New Issue
Block a user