Skip to content

Commit 38c81aa

Browse files
author
ogorkun
committed
AC-1344: Update Integrations
1 parent 9ff22de commit 38c81aa

File tree

3 files changed

+11
-12
lines changed

3 files changed

+11
-12
lines changed

app/code/Magento/Integration/Test/Unit/Oauth/OauthTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ protected function _getRequestTokenParams($amendments = [])
187187
),
188188
'oauth_nonce' => '',
189189
'oauth_timestamp' => time(),
190-
'oauth_signature_method' => OauthInterface::SIGNATURE_SHA1,
190+
'oauth_signature_method' => OauthInterface::SIGNATURE_SHA256,
191191
'oauth_signature' => 'invalid_signature',
192192
];
193193

@@ -871,7 +871,7 @@ protected function _getAccessTokenRequiredParams($amendments = [])
871871
Oauth::LENGTH_CONSUMER_KEY
872872
),
873873
'oauth_signature' => '',
874-
'oauth_signature_method' => OauthInterface::SIGNATURE_SHA1,
874+
'oauth_signature_method' => OauthInterface::SIGNATURE_SHA256,
875875
'oauth_nonce' => '',
876876
'oauth_timestamp' => (string)time(),
877877
'oauth_token' => $this->_generateRandomString(Oauth::LENGTH_TOKEN),

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,11 @@ public function __construct(
5656
/**
5757
* Retrieve array of supported signature methods.
5858
*
59-
* @return string[] - Supported HMAC-SHA1 and HMAC-SHA256 signature methods.
59+
* @return string[]
6060
*/
6161
public static function getSupportedSignatureMethods()
6262
{
63-
return [self::SIGNATURE_SHA1, self::SIGNATURE_SHA256];
63+
return [self::SIGNATURE_SHA256];
6464
}
6565

6666
/**
@@ -141,7 +141,7 @@ public function validateAccessToken($accessToken)
141141
public function buildAuthorizationHeader(
142142
$params,
143143
$requestUrl,
144-
$signatureMethod = self::SIGNATURE_SHA1,
144+
$signatureMethod = self::SIGNATURE_SHA256,
145145
$httpMethod = 'POST'
146146
) {
147147
$required = ["oauth_consumer_key", "oauth_consumer_secret", "oauth_token", "oauth_token_secret"];

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

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,10 @@ interface OauthInterface
5959
/**#@+
6060
* Signature Methods
6161
*/
62+
/**
63+
* @deprecated SHA1 is deprecated
64+
* @see SIGNATURE_SHA256
65+
*/
6266
const SIGNATURE_SHA1 = 'HMAC-SHA1';
6367

6468
const SIGNATURE_SHA256 = 'HMAC-SHA256';
@@ -167,20 +171,15 @@ public function validateAccessToken($accessToken);
167171
* );
168172
* </pre>
169173
* @param string $requestUrl e.g 'http://www.example.com/endpoint'
170-
* @param string $signatureMethod (default: 'HMAC-SHA1')
174+
* @param string $signatureMethod (default: 'HMAC-SHA256')
171175
* @param string $httpMethod (default: 'POST')
172176
* @return string
173-
* <pre>
174-
* OAuth oauth_version="1.0", oauth_signature_method="HMAC-SHA1", oauth_nonce="5X1aWR2qzf2uFm1",
175-
* oauth_timestamp="1381930661", oauth_consumer_key="34edf957ef88492f0a32eb7e1731e85d",
176-
* oauth_token="7c0709f789e1f38a17aa4b9a28e1b06c", oauth_signature="agVxK0epXOOeQK4%2Bc7UAqUXoAok%3D"
177-
* <pre>
178177
* @throws \Magento\Framework\Oauth\Exception
179178
*/
180179
public function buildAuthorizationHeader(
181180
$params,
182181
$requestUrl,
183-
$signatureMethod = self::SIGNATURE_SHA1,
182+
$signatureMethod = self::SIGNATURE_SHA256,
184183
$httpMethod = 'POST'
185184
);
186185
}

0 commit comments

Comments
 (0)