From 5eb565740b5e8385aadc7ebb90559e4d55d3092d Mon Sep 17 00:00:00 2001 From: Tom Kay Date: Thu, 30 Jan 2020 10:49:16 +0000 Subject: [PATCH] check format of payload to decode --- src/Fident.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Fident.php b/src/Fident.php index 9298d77..653b954 100644 --- a/src/Fident.php +++ b/src/Fident.php @@ -41,6 +41,10 @@ public function verifyJwt(string $rawJwt): bool public function decodeJwtPayload(string $rawJwt): ?FidentJwtData { $data = new FidentJwtData(); + if(substr_count($rawJwt, '.') !== 2) + { + return $data; + } [, $payload64,] = explode('.', $rawJwt, 3); $payload = json_decode(Strings::urlsafeBase64Decode($payload64));