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 18
18
use OAuth \OAuth1 \Signature \SignatureInterface ;
19
19
use OAuth \OAuth1 \Token \StdOAuth1Token ;
20
20
use OAuth \OAuth1 \Token \TokenInterface ;
21
+ use Laminas \OAuth \Http \Utility as HTTPUtility ;
22
+ use Magento \Framework \Oauth \Helper \Signature \Hmac256 ;
21
23
22
24
/**
23
25
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
@@ -56,7 +58,7 @@ public function __construct(
56
58
$ storage = new \OAuth \Common \Storage \Memory ();
57
59
}
58
60
if (!isset ($ helper )) {
59
- $ helper = new Utility ();
61
+ $ helper = new Utility (new HTTPUtility (), new Hmac256 () );
60
62
}
61
63
if (!isset ($ signature )) {
62
64
$ signature = new \Magento \TestFramework \Authentication \Rest \OauthClient \Signature ($ helper , $ credentials );
Original file line number Diff line number Diff line change 1
1
<?php
2
+ /**
3
+ * Copyright 2024 Adobe
4
+ * All Rights Reserved.
5
+ */
6
+ declare (strict_types=1 );
2
7
3
8
namespace Magento \Framework \Oauth \Helper \Signature ;
4
9
@@ -10,7 +15,7 @@ class Hmac256
10
15
* Sign a request
11
16
*
12
17
* @param array $params
13
- * @param string $signatureMethod
18
+ * @param string $algo
14
19
* @param string $consumerSecret
15
20
* @param string|null $tokenSecret
16
21
* @param mixed $method
@@ -19,7 +24,7 @@ class Hmac256
19
24
*/
20
25
public function sign (
21
26
array $ params ,
22
- string $ signatureMethod ,
27
+ string $ algo ,
23
28
string $ consumerSecret ,
24
29
?string $ tokenSecret = null ,
25
30
?string $ method = null ,
@@ -29,7 +34,7 @@ public function sign(
29
34
30
35
$ binaryHash = HMACEncryption::compute (
31
36
$ this ->assembleKey ($ consumerSecret , $ tokenSecret ),
32
- $ signatureMethod ,
37
+ $ algo ,
33
38
$ this ->getBaseSignatureString ($ params , $ method , $ url ),
34
39
HMACEncryption::OUTPUT_BINARY
35
40
);
Original file line number Diff line number Diff line change @@ -47,14 +47,14 @@ public function sign(
47
47
}
48
48
49
49
/**
50
- * Check if signature method is HMAC256
50
+ * Check if signature method is HMAC-SHA256
51
51
*
52
52
* @param string $signatureMethod
53
53
* @return bool
54
54
*/
55
55
private function isHmac256 (string $ signatureMethod ): bool
56
56
{
57
- if (strtoupper (preg_replace ( '/[\W]/ ' , '' , $ signatureMethod )) === 'HMAC256 ' ) {
57
+ if (strtoupper (preg_replace ( '/[\W]/ ' , '' , $ signatureMethod )) === 'HMACSHA256 ' ) {
58
58
return true ;
59
59
}
60
60
You can’t perform that action at this time.
0 commit comments