mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-13 06:55:29 +00:00
Login verification: guilty until proven innocent
assume it's invalid until we've verified everything
This commit is contained in:
parent
90cb018de2
commit
7a77bb0402
@ -42,7 +42,7 @@ class VerifyLoginTask extends AsyncTask{
|
|||||||
* has an invalid signature. If false, the keychain might have been tampered with.
|
* has an invalid signature. If false, the keychain might have been tampered with.
|
||||||
* The player will always be disconnected if this is false.
|
* The player will always be disconnected if this is false.
|
||||||
*/
|
*/
|
||||||
private $valid = true;
|
private $valid = false;
|
||||||
/**
|
/**
|
||||||
* @var bool
|
* @var bool
|
||||||
* Whether the player is logged into Xbox Live. This is true if any link in the keychain is signed with the Mojang
|
* Whether the player is logged into Xbox Live. This is true if any link in the keychain is signed with the Mojang
|
||||||
@ -63,15 +63,15 @@ class VerifyLoginTask extends AsyncTask{
|
|||||||
|
|
||||||
foreach($packet->chainData["chain"] as $jwt){
|
foreach($packet->chainData["chain"] as $jwt){
|
||||||
if(!$this->validateToken($jwt, $currentKey)){
|
if(!$this->validateToken($jwt, $currentKey)){
|
||||||
$this->valid = false;
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!$this->validateToken($packet->clientDataJwt, $currentKey)){
|
if(!$this->validateToken($packet->clientDataJwt, $currentKey)){
|
||||||
$this->valid = false;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->valid = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function validateToken(string $jwt, ?string &$currentPublicKey) : bool{
|
private function validateToken(string $jwt, ?string &$currentPublicKey) : bool{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user