Update to Laravel 8
Co-authored-by: Matthew Penner <me@matthewp.io>
This commit is contained in:
parent
028921b42a
commit
a043071e3c
211 changed files with 4394 additions and 2933 deletions
33
app/Extensions/Lcobucci/JWT/Encoding/TimestampDates.php
Normal file
33
app/Extensions/Lcobucci/JWT/Encoding/TimestampDates.php
Normal file
|
@ -0,0 +1,33 @@
|
|||
<?php
|
||||
|
||||
namespace Pterodactyl\Extensions\Lcobucci\JWT\Encoding;
|
||||
|
||||
use DateTimeImmutable;
|
||||
use Lcobucci\JWT\ClaimsFormatter;
|
||||
use Lcobucci\JWT\Token\RegisteredClaims;
|
||||
|
||||
final class TimestampDates implements ClaimsFormatter
|
||||
{
|
||||
/**
|
||||
* The default time encoder for JWTs using this library is not supported correctly
|
||||
* by Wings and will cause a flood of errors and panic conditions because the times
|
||||
* cannot be parsed correctly. The default is time with microseconds, we just need
|
||||
* to use the normal unix timestamp here.
|
||||
*
|
||||
* @param array $claims
|
||||
* @return array
|
||||
*/
|
||||
public function formatClaims(array $claims): array
|
||||
{
|
||||
foreach (RegisteredClaims::DATE_CLAIMS as $claim) {
|
||||
if (! array_key_exists($claim, $claims)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
assert($claims[$claim] instanceof DateTimeImmutable);
|
||||
$claims[$claim] = $claims[$claim]->getTimestamp();
|
||||
}
|
||||
|
||||
return $claims;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue