Skip to content

Commit 021670c

Browse files
committed
AC-1619: Integration access tokens do not work as Bearer tokens
1 parent 0b6397a commit 021670c

File tree

5 files changed

+7
-7
lines changed

5 files changed

+7
-7
lines changed

app/code/Magento/Analytics/Plugin/BearerTokenValidatorPlugin.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public function __construct(ScopeConfigInterface $config)
3939
* @return bool
4040
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
4141
*/
42-
public function afterIsIntegrationAllowedToAsBearerToken(
42+
public function afterIsIntegrationAllowedAsBearerToken(
4343
BearerTokenValidator $subject,
4444
bool $result,
4545
Integration $integration

app/code/Magento/Analytics/Test/Unit/Plugin/BearerTokenValidatorPluginTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public function testTrueIsPassedThrough()
4444
->with('getName')
4545
->willReturn('invalid');
4646

47-
$result = $this->plugin->afterIsIntegrationAllowedToAsBearerToken($this->validator, true, $integration);
47+
$result = $this->plugin->afterIsIntegrationAllowedAsBearerToken($this->validator, true, $integration);
4848
self::assertTrue($result);
4949
}
5050

@@ -55,7 +55,7 @@ public function testFalseWhenIntegrationDoesntMatch()
5555
->with('getName')
5656
->willReturn('invalid');
5757

58-
$result = $this->plugin->afterIsIntegrationAllowedToAsBearerToken($this->validator, false, $integration);
58+
$result = $this->plugin->afterIsIntegrationAllowedAsBearerToken($this->validator, false, $integration);
5959
self::assertFalse($result);
6060
}
6161

@@ -66,7 +66,7 @@ public function testTrueWhenIntegrationMatches()
6666
->with('getName')
6767
->willReturn('abc');
6868

69-
$result = $this->plugin->afterIsIntegrationAllowedToAsBearerToken($this->validator, true, $integration);
69+
$result = $this->plugin->afterIsIntegrationAllowedAsBearerToken($this->validator, true, $integration);
7070
self::assertTrue($result);
7171
}
7272
}

app/code/Magento/Integration/Model/OpaqueToken/Reader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ private function getUserId(Token $tokenModel): int
143143
$userId = $tokenModel->getAdminId();
144144
} elseif ($userType === CustomUserContext::USER_TYPE_INTEGRATION) {
145145
$integration = $this->integrationService->findByConsumerId($tokenModel->getConsumerId());
146-
if ($this->bearerTokenValidator->isIntegrationAllowedToAsBearerToken($integration)) {
146+
if ($this->bearerTokenValidator->isIntegrationAllowedAsBearerToken($integration)) {
147147
$userId = $integration->getId();
148148
}
149149
} else {

app/code/Magento/Integration/Model/Validator/BearerTokenValidator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public function __construct(AuthorizationConfig $authorizationConfig)
3636
* @return bool
3737
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
3838
*/
39-
public function isIntegrationAllowedToAsBearerToken(Integration $integration): bool
39+
public function isIntegrationAllowedAsBearerToken(Integration $integration): bool
4040
{
4141
return $this->authorizationConfig->isIntegrationAsBearerEnabled();
4242
}

app/code/Magento/Webapi/Model/Authorization/SoapUserContext.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ private function processRequest() //phpcs:ignore CopyPaste
129129
}
130130
if (((int) $token->getUserType()) === UserContextInterface::USER_TYPE_INTEGRATION) {
131131
$integration = $this->integrationService->findByConsumerId($token->getConsumerId());
132-
if ($this->bearerTokenValidator->isIntegrationAllowedToAsBearerToken($integration)) {
132+
if ($this->bearerTokenValidator->isIntegrationAllowedAsBearerToken($integration)) {
133133
$this->userId = $integration->getId();
134134
$this->userType = UserContextInterface::USER_TYPE_INTEGRATION;
135135
}

0 commit comments

Comments
 (0)