Skip to content

Commit c26b670

Browse files
committed
ACPT-113: [BUG] Adobe Stock doesn't allow to license an image if configured via Magento config
1 parent bd715ae commit c26b670

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

app/code/Magento/AdobeIms/Model/GetAccessToken.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,9 @@ public function execute(int $adminUserId = null): ?string
5555
{
5656
try {
5757
$adminUserId = $adminUserId ?? (int) $this->userContext->getUserId();
58-
return $this->userProfileRepository->getByUserId($adminUserId)->getAccessToken();
58+
return $this->encryptor->decrypt(
59+
$this->userProfileRepository->getByUserId($adminUserId)->getAccessToken()
60+
);
5961
} catch (NoSuchEntityException $exception) {
6062
return null;
6163
}

app/code/Magento/AdobeIms/Test/Unit/Model/GetAccessTokenTest.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,13 @@ public function testExecute(?string $token): void
7272
->willReturn($userProfileMock);
7373
$userProfileMock->expects($this->once())->method('getAccessToken')->willReturn($token);
7474

75+
$decryptedToken = $token ?? '';
76+
77+
$this->encryptor->expects($this->once())
78+
->method('decrypt')
79+
->with($token)
80+
->willReturn($decryptedToken);
81+
7582
$this->assertEquals($token, $this->getAccessToken->execute());
7683
}
7784

0 commit comments

Comments
 (0)