Skip to content

Commit a1b777d

Browse files
committed
AC-1271: Add rate limiting for payment information endpoint and mutation
1 parent a8954c6 commit a1b777d

File tree

4 files changed

+21
-37
lines changed

4 files changed

+21
-37
lines changed

app/code/Magento/GraphQl/Model/Backpressure/BackpressureContextFactory.php

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -62,15 +62,12 @@ public function create(Field $field): ?ContextInterface
6262
return null;
6363
}
6464

65-
return ObjectManager::getInstance()->create(
66-
GraphQlContext::class,
67-
[
68-
$this->request,
69-
$this->identityProvider->fetchIdentity(),
70-
$this->identityProvider->fetchIdentityType(),
71-
$typeId,
72-
$field->getResolver()
73-
]
65+
return new GraphQlContext(
66+
$this->request,
67+
$this->identityProvider->fetchIdentity(),
68+
$this->identityProvider->fetchIdentityType(),
69+
$typeId,
70+
$field->getResolver()
7471
);
7572
}
7673
}

app/code/Magento/Quote/Model/Backpressure/OrderLimitConfigManager.php

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,7 @@ public function readLimit(ContextInterface $context): LimitConfig
5555
throw new RuntimeException(__("Identity type not found"));
5656
}
5757

58-
return ObjectManager::getInstance()->create(
59-
LimitConfig::class,
60-
[
61-
$limit,
62-
$this->fetchPeriod()
63-
]
64-
);
58+
return new LimitConfig($limit, $this->fetchPeriod());
6559
}
6660

6761
/**

lib/internal/Magento/Framework/App/Request/Backpressure/ContextFactory.php

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -62,15 +62,12 @@ public function create(ActionInterface $action): ?ContextInterface
6262
return null;
6363
}
6464

65-
return ObjectManager::getInstance()->create(
66-
ControllerContext::class,
67-
[
68-
$this->request,
69-
$this->identityProvider->fetchIdentity(),
70-
$this->identityProvider->fetchIdentityType(),
71-
$typeId,
72-
$action
73-
]
65+
return new ControllerContext(
66+
$this->request,
67+
$this->identityProvider->fetchIdentity(),
68+
$this->identityProvider->fetchIdentityType(),
69+
$typeId,
70+
$action
7471
);
7572
}
7673
}

lib/internal/Magento/Framework/Webapi/Backpressure/BackpressureContextFactory.php

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
use Magento\Framework\App\Backpressure\ContextInterface;
1212
use Magento\Framework\App\Backpressure\IdentityProviderInterface;
13-
use Magento\Framework\App\ObjectManager;
1413
use Magento\Framework\App\RequestInterface;
1514

1615
/**
@@ -63,17 +62,14 @@ public function create(string $service, string $method, string $endpoint): ?Cont
6362
return null;
6463
}
6564

66-
return ObjectManager::getInstance()->create(
67-
RestContext::class,
68-
[
69-
$this->request,
70-
$this->identityProvider->fetchIdentity(),
71-
$this->identityProvider->fetchIdentityType(),
72-
$typeId,
73-
$service,
74-
$method,
75-
$endpoint
76-
]
65+
return new RestContext(
66+
$this->request,
67+
$this->identityProvider->fetchIdentity(),
68+
$this->identityProvider->fetchIdentityType(),
69+
$typeId,
70+
$service,
71+
$method,
72+
$endpoint
7773
);
7874
}
7975
}

0 commit comments

Comments
 (0)