Skip to content

Commit 5eb5657

Browse files
committed
check format of payload to decode
1 parent ba89e2c commit 5eb5657

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/Fident.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ public function verifyJwt(string $rawJwt): bool
4141
public function decodeJwtPayload(string $rawJwt): ?FidentJwtData
4242
{
4343
$data = new FidentJwtData();
44+
if(substr_count($rawJwt, '.') !== 2)
45+
{
46+
return $data;
47+
}
4448

4549
[, $payload64,] = explode('.', $rawJwt, 3);
4650
$payload = json_decode(Strings::urlsafeBase64Decode($payload64));

0 commit comments

Comments
 (0)