File tree Expand file tree Collapse file tree 3 files changed +13
-6
lines changed
dev/tests/api-functional/framework/Magento/TestFramework/Authentication/Rest
lib/internal/Magento/Framework/Oauth/Helper Expand file tree Collapse file tree 3 files changed +13
-6
lines changed Original file line number Diff line number Diff line change 1818use OAuth \OAuth1 \Signature \SignatureInterface ;
1919use OAuth \OAuth1 \Token \StdOAuth1Token ;
2020use OAuth \OAuth1 \Token \TokenInterface ;
21+ use Laminas \OAuth \Http \Utility as HTTPUtility ;
22+ use Magento \Framework \Oauth \Helper \Signature \Hmac256 ;
2123
2224/**
2325 * @SuppressWarnings(PHPMD.CouplingBetweenObjects)
@@ -56,7 +58,7 @@ public function __construct(
5658 $ storage = new \OAuth \Common \Storage \Memory ();
5759 }
5860 if (!isset ($ helper )) {
59- $ helper = new Utility ();
61+ $ helper = new Utility (new HTTPUtility (), new Hmac256 () );
6062 }
6163 if (!isset ($ signature )) {
6264 $ signature = new \Magento \TestFramework \Authentication \Rest \OauthClient \Signature ($ helper , $ credentials );
Original file line number Diff line number Diff line change 11<?php
2+ /**
3+ * Copyright 2024 Adobe
4+ * All Rights Reserved.
5+ */
6+ declare (strict_types=1 );
27
38namespace Magento \Framework \Oauth \Helper \Signature ;
49
@@ -10,7 +15,7 @@ class Hmac256
1015 * Sign a request
1116 *
1217 * @param array $params
13- * @param string $signatureMethod
18+ * @param string $algo
1419 * @param string $consumerSecret
1520 * @param string|null $tokenSecret
1621 * @param mixed $method
@@ -19,7 +24,7 @@ class Hmac256
1924 */
2025 public function sign (
2126 array $ params ,
22- string $ signatureMethod ,
27+ string $ algo ,
2328 string $ consumerSecret ,
2429 ?string $ tokenSecret = null ,
2530 ?string $ method = null ,
@@ -29,7 +34,7 @@ public function sign(
2934
3035 $ binaryHash = HMACEncryption::compute (
3136 $ this ->assembleKey ($ consumerSecret , $ tokenSecret ),
32- $ signatureMethod ,
37+ $ algo ,
3338 $ this ->getBaseSignatureString ($ params , $ method , $ url ),
3439 HMACEncryption::OUTPUT_BINARY
3540 );
Original file line number Diff line number Diff line change @@ -47,14 +47,14 @@ public function sign(
4747 }
4848
4949 /**
50- * Check if signature method is HMAC256
50+ * Check if signature method is HMAC-SHA256
5151 *
5252 * @param string $signatureMethod
5353 * @return bool
5454 */
5555 private function isHmac256 (string $ signatureMethod ): bool
5656 {
57- if (strtoupper (preg_replace ( '/[\W]/ ' , '' , $ signatureMethod )) === 'HMAC256 ' ) {
57+ if (strtoupper (preg_replace ( '/[\W]/ ' , '' , $ signatureMethod )) === 'HMACSHA256 ' ) {
5858 return true ;
5959 }
6060
You can’t perform that action at this time.
0 commit comments