Skip to content

Commit

Permalink
Merge pull request #16 from irontec/CDD-35-increase-jwt-created-callb…
Browse files Browse the repository at this point in the history
…ack-priority

Increase jwt created callback priority
  • Loading branch information
danigargar authored Apr 9, 2024
2 parents 534b49c + 7064c17 commit 7e4d5f0
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 1 deletion.
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

0 comments on commit 7e4d5f0

Please sign in to comment.