Initial php8 work
- switch to GD for image work - fix issues around jwt
This commit is contained in:
parent
303b0e66ca
commit
6942fc1d32
9 changed files with 370 additions and 337 deletions
|
@ -21,6 +21,8 @@ use Illuminate\Support\Facades\Storage;
|
|||
use Illuminate\Support\Str;
|
||||
use Intervention\Image\Exception\NotReadableException;
|
||||
use Intervention\Image\ImageManager;
|
||||
use Lcobucci\JWT\Token\InvalidTokenStructure;
|
||||
use Lcobucci\JWT\Validation\RequiredConstraintsViolated;
|
||||
use Ramsey\Uuid\Uuid;
|
||||
|
||||
class MicropubMediaController extends Controller
|
||||
|
@ -36,19 +38,19 @@ class MicropubMediaController extends Controller
|
|||
{
|
||||
try {
|
||||
$tokenData = $this->tokenService->validateToken(request()->input('access_token'));
|
||||
} catch (InvalidTokenException $e) {
|
||||
} catch (RequiredConstraintsViolated | InvalidTokenStructure) {
|
||||
$micropubResponses = new MicropubResponses();
|
||||
|
||||
return $micropubResponses->invalidTokenResponse();
|
||||
}
|
||||
|
||||
if ($tokenData->hasClaim('scope') === false) {
|
||||
if ($tokenData->claims()->has('scope') === false) {
|
||||
$micropubResponses = new MicropubResponses();
|
||||
|
||||
return $micropubResponses->tokenHasNoScopeResponse();
|
||||
}
|
||||
|
||||
if (Str::contains($tokenData->getClaim('scope'), 'create') === false) {
|
||||
if (Str::contains($tokenData->claims()->get('scope'), 'create') === false) {
|
||||
$micropubResponses = new MicropubResponses();
|
||||
|
||||
return $micropubResponses->insufficientScopeResponse();
|
||||
|
@ -103,19 +105,19 @@ class MicropubMediaController extends Controller
|
|||
{
|
||||
try {
|
||||
$tokenData = $this->tokenService->validateToken(request()->input('access_token'));
|
||||
} catch (InvalidTokenException $e) {
|
||||
} catch (RequiredConstraintsViolated | InvalidTokenStructure) {
|
||||
$micropubResponses = new MicropubResponses();
|
||||
|
||||
return $micropubResponses->invalidTokenResponse();
|
||||
}
|
||||
|
||||
if ($tokenData->hasClaim('scope') === false) {
|
||||
if ($tokenData->claims()->has('scope') === false) {
|
||||
$micropubResponses = new MicropubResponses();
|
||||
|
||||
return $micropubResponses->tokenHasNoScopeResponse();
|
||||
}
|
||||
|
||||
if (Str::contains($tokenData->getClaim('scope'), 'create') === false) {
|
||||
if (Str::contains($tokenData->claims()->get('scope'), 'create') === false) {
|
||||
$micropubResponses = new MicropubResponses();
|
||||
|
||||
return $micropubResponses->insufficientScopeResponse();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue