Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Increase jwt created callback priority #16

Merged
merged 2 commits into from
Apr 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion Operation/ExchangeToken.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Ivoz\Api\Operation;

use ApiPlatform\Core\EventListener\EventPriorities;
use ApiPlatform\Core\Exception\ResourceClassNotFoundException;
use Lexik\Bundle\JWTAuthenticationBundle\Event\JWTCreatedEvent;
use Lexik\Bundle\JWTAuthenticationBundle\Events;
Expand Down Expand Up @@ -92,6 +93,12 @@ public function execute(string $inputToken, string $username): string
$tokenChain[] = $parentAdminTokenPayload['onBehalfOf'];
}
$tokenChain[] = $parentAdminTokenPayload['iden'];

if (isset($parentAdminTokenPayload['onBehalfOfIds'])) {
$payload['onBehalfOfIds'] = $parentAdminTokenPayload['onBehalfOfIds'];
}
$payload['onBehalfOfIds'][] = $targetAdmin->getId();

$payload['onBehalfOf'] = implode(' > ', $tokenChain);
$payload['iden'] = (string) $targetAdmin;

Expand All @@ -100,7 +107,8 @@ public function execute(string $inputToken, string $username): string

$this->eventDispatcher->addListener(
Events::JWT_CREATED,
$payloadModifier
$payloadModifier,
EventPriorities::PRE_VALIDATE
);

$newToken = $this->jwtTokenManager->create($targetAdmin);
Expand Down
60 changes: 60 additions & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,63 @@ parameters:
- vendor
ignoreErrors:
- '#Parameter \#2 \$hydrationMode of method Doctrine\\ORM\\Query::iterate\(\) expects [0-9\|]+string\|null, 101 given#'

-
message: "#^Deprecated in PHP 8\\.1\\: Required parameter \\$resourceMetadataFactory follows optional parameter \\$nameConverter\\.$#"
count: 1
path: Doctrine/Orm/Filter/BooleanFilter.php

-
message: "#^Deprecated in PHP 8\\.1\\: Required parameter \\$resourceMetadataFactory follows optional parameter \\$nameConverter\\.$#"
count: 1
path: Doctrine/Orm/Filter/DateFilter.php

-
message: "#^Deprecated in PHP 8\\.1\\: Required parameter \\$resourceMetadataFactory follows optional parameter \\$nameConverter\\.$#"
count: 1
path: Doctrine/Orm/Filter/NotEqualFilter.php

-
message: "#^Deprecated in PHP 8\\.1\\: Required parameter \\$resourceMetadataFactory follows optional parameter \\$nameConverter\\.$#"
count: 1
path: Doctrine/Orm/Filter/NumericFilter.php

-
message: "#^Deprecated in PHP 8\\.0\\: Required parameter \\$resourceMetadataFactory follows optional parameter \\$requestStack\\.$#"
count: 1
path: Doctrine/Orm/Filter/OrderFilter.php

-
message: "#^Deprecated in PHP 8\\.1\\: Required parameter \\$orderParameterName follows optional parameter \\$requestStack\\.$#"
count: 1
path: Doctrine/Orm/Filter/OrderFilter.php

-
message: "#^Deprecated in PHP 8\\.1\\: Required parameter \\$resourceMetadataFactory follows optional parameter \\$properties\\.$#"
count: 1
path: Doctrine/Orm/Filter/RangeFilter.php

-
message: "#^Deprecated in PHP 8\\.0\\: Required parameter \\$resourceMetadataFactory follows optional parameter \\$requestStack\\.$#"
count: 1
path: Doctrine/Orm/Filter/SearchFilter.php

-
message: "#^Deprecated in PHP 8\\.1\\: Required parameter \\$iriConverter follows optional parameter \\$requestStack\\.$#"
count: 1
path: Doctrine/Orm/Filter/SearchFilter.php

-
message: "#^Deprecated in PHP 8\\.0\\: Required parameter \\$propertyMetadataFactory follows optional parameter \\$requestStack\\.$#"
count: 1
path: Doctrine/Orm/Filter/SearchFilterExact.php

-
message: "#^Deprecated in PHP 8\\.0\\: Required parameter \\$resourceMetadataFactory follows optional parameter \\$requestStack\\.$#"
count: 1
path: Doctrine/Orm/Filter/SearchFilterExact.php

-
message: "#^Deprecated in PHP 8\\.1\\: Required parameter \\$iriConverter follows optional parameter \\$requestStack\\.$#"
count: 1
path: Doctrine/Orm/Filter/SearchFilterExact.php
Loading