Skip to content

Commit e54ffe6

Browse files
author
ogorkun
committed
AC-1344: Update Integrations
1 parent 1c99a8e commit e54ffe6

File tree

3 files changed

+20
-10
lines changed

3 files changed

+20
-10
lines changed

dev/tests/api-functional/framework/Magento/TestFramework/Authentication/Rest/OauthClient.php

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,13 @@ class OauthClient extends AbstractService
3232
/** @var string|null */
3333
protected $_oauthVerifier = null;
3434

35+
/**
36+
* @param Credentials $credentials
37+
* @param ClientInterface|null $httpClient
38+
* @param TokenStorageInterface|null $storage
39+
* @param SignatureInterface|null $signature
40+
* @param UriInterface|null $baseApiUri
41+
*/
3542
public function __construct(
3643
Credentials $credentials,
3744
ClientInterface $httpClient = null,
@@ -53,17 +60,15 @@ public function __construct(
5360
}
5461

5562
/**
56-
* @return UriInterface
63+
* @inheritDoc
5764
*/
5865
public function getRequestTokenEndpoint()
5966
{
6067
return new Uri(TESTS_BASE_URL . '/oauth/token/request');
6168
}
6269

6370
/**
64-
* Returns the authorization API endpoint.
65-
*
66-
* @return UriInterface
71+
* @inheritDoc
6772
*/
6873
public function getAuthorizationEndpoint()
6974
{
@@ -171,19 +176,22 @@ protected function _parseResponseBody($responseBody)
171176
*/
172177
public function getOauthVerifier()
173178
{
174-
if (!isset($this->_oauthVerifier) || isEmpty($this->_oauthVerifier)) {
179+
if (empty($this->_oauthVerifier)) {
175180
throw new TokenResponseException("oAuth verifier must be obtained during request token request.");
176181
}
177182
return $this->_oauthVerifier;
178183
}
179184

180185
/**
181-
* @override to fix since parent implementation from lib not sending the oauth_verifier when requesting access token
182-
* Builds the authorization header for an authenticated API request
186+
* Builds the authorization header for an authenticated API request.
187+
*
188+
* Fixing this method since parent implementation from lib not sending the oauth_verifier
189+
* when requesting access token.
190+
*
183191
* @param string $method
184192
* @param UriInterface $uri the uri the request is headed
185193
* @param \OAuth\OAuth1\Token\TokenInterface $token
186-
* @param $bodyParams array
194+
* @param array|null $bodyParams
187195
* @return string
188196
*/
189197
protected function buildAuthorizationHeaderForAPIRequest(

dev/tests/api-functional/framework/Magento/TestFramework/Authentication/Rest/OauthClient/Signature.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
class Signature extends \OAuth\OAuth1\Signature\Signature
1515
{
1616
/**
17-
* {@inheritdoc}
17+
* @inheritDoc
1818
*
1919
* In addition to the original method, allows array parameters for filters.
2020
*/
@@ -30,6 +30,7 @@ function ($carry, $item) {
3030
[]
3131
);
3232

33+
$signatureData = [];
3334
foreach (array_merge($queryStringData, $params) as $key => $value) {
3435
$signatureData[rawurlencode($key)] = rawurlencode($value);
3536
}

lib/internal/Magento/Framework/Oauth/Oauth.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
use Magento\Framework\Encryption\Helper\Security;
1010
use Magento\Framework\Phrase;
11+
use Magento\Framework\Oauth\Exception as AuthException;
1112

1213
/**
1314
* Authorization service.
@@ -202,7 +203,7 @@ protected function _validateSignature($params, $consumerSecret, $httpMethod, $re
202203
);
203204

204205
if (!Security::compareStrings($calculatedSign, $params['oauth_signature'])) {
205-
throw new Exception(new Phrase('The signature is invalid. Verify and try again.'));
206+
throw new AuthException(new Phrase('The signature is invalid. Verify and try again.'));
206207
}
207208
}
208209

0 commit comments

Comments
 (0)