Skip to content

Commit e24d437

Browse files
committed
Replace security with token storage & increase retry delay
1 parent 67b8ae9 commit e24d437

3 files changed

Lines changed: 6 additions & 10 deletions

File tree

config/packages/messenger.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ framework:
55
dsn: "%env(MESSENGER_USER_COM_ASYNCHRONOUS)%"
66
retry_strategy:
77
max_retries: 5
8-
delay: 60000
8+
delay: 300000
99
multiplier: 2
1010
routing:
1111
BitBag\SyliusUserComPlugin\Message\OrderSynchronization: user_com_asynchronous

config/services/manager.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
class="BitBag\SyliusUserComPlugin\Manager\CookieManager"
99
>
1010
<argument type="service" id="request_stack"/>
11-
<argument type="service" id="security.helper"/>
11+
<argument type="service" id="security.token_storage"/>
1212
</service>
1313

1414
<service

src/Manager/CookieManager.php

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,14 @@
1212
namespace BitBag\SyliusUserComPlugin\Manager;
1313

1414
use Sylius\Component\Core\Model\AdminUserInterface;
15-
use Sylius\Component\Core\Model\ShopUserInterface;
16-
use Symfony\Bundle\SecurityBundle\Security;
1715
use Symfony\Component\HttpFoundation\RequestStack;
16+
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
1817

1918
final class CookieManager implements CookieManagerInterface
2019
{
2120
public function __construct(
2221
private readonly RequestStack $requestStack,
23-
private readonly Security $security,
22+
private readonly TokenStorageInterface $tokenStorage,
2423
) {
2524
}
2625

@@ -51,11 +50,8 @@ public function setUserComCookie(string $value): void
5150

5251
private function isShopUser(): bool
5352
{
54-
$user = $this->security->getUser();
55-
56-
if ($user instanceof ShopUserInterface) {
57-
return true;
58-
}
53+
$token = $this->tokenStorage->getToken();
54+
$user = $token?->getUser();
5955

6056
if ($user instanceof AdminUserInterface) {
6157
return false;

0 commit comments

Comments
 (0)