Skip to content

Commit

Permalink
check format of payload to decode
Browse files Browse the repository at this point in the history
  • Loading branch information
TomK committed Jan 30, 2020
1 parent ba89e2c commit 5eb5657
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Fident.php
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down

0 comments on commit 5eb5657

Please sign in to comment.