File tree Expand file tree Collapse file tree 6 files changed +76
-7
lines changed
app/code/Magento/JwtFrameworkAdapter Expand file tree Collapse file tree 6 files changed +76
-7
lines changed Original file line number Diff line number Diff line change
1
+ <?php
2
+ /**
3
+ * Copyright © Magento, Inc. All rights reserved.
4
+ * See COPYING.txt for license details.
5
+ */
6
+
7
+ declare (strict_types=1 );
8
+
9
+ namespace Magento \JwtFrameworkAdapter \Model ;
10
+
11
+ use Jose \Easy \AlgorithmProvider ;
12
+
13
+ class AlgorithmProviderFactory
14
+ {
15
+ /**
16
+ * Create provider instance.
17
+ *
18
+ * @param string[] $algorithms Algorithm classes.
19
+ * @return AlgorithmProvider
20
+ */
21
+ public function create (array $ algorithms ): AlgorithmProvider
22
+ {
23
+ return new AlgorithmProvider ($ algorithms );
24
+ }
25
+ }
Original file line number Diff line number Diff line change 9
9
namespace Magento \JwtFrameworkAdapter \Model ;
10
10
11
11
use Jose \Component \Core \AlgorithmManager ;
12
- use Jose \Easy \AlgorithmProvider ;
13
12
14
13
class JweAlgorithmManagerFactory
15
14
{
@@ -32,8 +31,17 @@ class JweAlgorithmManagerFactory
32
31
\Jose \Component \Encryption \Algorithm \KeyEncryption \PBES2HS512A256KW ::class
33
32
];
34
33
34
+ /**
35
+ * @var AlgorithmProviderFactory
36
+ */
37
+ private $ algorithmProviderFactory ;
38
+
39
+ public function __construct (AlgorithmProviderFactory $ algorithmProviderFactory ) {
40
+ $ this ->algorithmProviderFactory = $ algorithmProviderFactory ;
41
+ }
42
+
35
43
public function create (): AlgorithmManager
36
44
{
37
- return new AlgorithmManager (( new AlgorithmProvider ( self ::ALGOS ) )->getAvailableAlgorithms ());
45
+ return new AlgorithmManager ($ this -> algorithmProviderFactory -> create ( self ::ALGOS )->getAvailableAlgorithms ());
38
46
}
39
47
}
Original file line number Diff line number Diff line change 9
9
namespace Magento \JwtFrameworkAdapter \Model ;
10
10
11
11
use Jose \Component \Encryption \Compression \CompressionMethodManager ;
12
- use Jose \Component \Encryption \Compression \Deflate ;
13
12
14
13
class JweCompressionManagerFactory
15
14
{
15
+ /**
16
+ * @var \Jose\Component\Encryption\Compression\CompressionMethod[]
17
+ */
18
+ private $ methods ;
19
+
20
+ /**
21
+ * @param \Jose\Component\Encryption\Compression\CompressionMethod[] $methods
22
+ */
23
+ public function __construct (array $ methods )
24
+ {
25
+ $ this ->methods = $ methods ;
26
+ }
27
+
16
28
public function create (): CompressionMethodManager
17
29
{
18
- return new CompressionMethodManager ([ new Deflate ()] );
30
+ return new CompressionMethodManager ($ this -> methods );
19
31
}
20
32
}
Original file line number Diff line number Diff line change 9
9
namespace Magento \JwtFrameworkAdapter \Model ;
10
10
11
11
use Jose \Component \Core \AlgorithmManager ;
12
- use Jose \Easy \AlgorithmProvider ;
13
12
14
13
class JweContentAlgorithmManagerFactory
15
14
{
@@ -22,8 +21,17 @@ class JweContentAlgorithmManagerFactory
22
21
\Jose \Component \Encryption \Algorithm \ContentEncryption \A256GCM ::class,
23
22
];
24
23
24
+ /**
25
+ * @var AlgorithmProviderFactory
26
+ */
27
+ private $ algorithmProviderFactory ;
28
+
29
+ public function __construct (AlgorithmProviderFactory $ algorithmProviderFactory ) {
30
+ $ this ->algorithmProviderFactory = $ algorithmProviderFactory ;
31
+ }
32
+
25
33
public function create (): AlgorithmManager
26
34
{
27
- return new AlgorithmManager (( new AlgorithmProvider ( self ::ALGOS ) )->getAvailableAlgorithms ());
35
+ return new AlgorithmManager ($ this -> algorithmProviderFactory -> create ( self ::ALGOS )->getAvailableAlgorithms ());
28
36
}
29
37
}
Original file line number Diff line number Diff line change @@ -31,8 +31,17 @@ class JwsAlgorithmManagerFactory
31
31
\Jose \Component \Signature \Algorithm \None::class
32
32
];
33
33
34
+ /**
35
+ * @var AlgorithmProviderFactory
36
+ */
37
+ private $ algorithmProviderFactory ;
38
+
39
+ public function __construct (AlgorithmProviderFactory $ algorithmProviderFactory ) {
40
+ $ this ->algorithmProviderFactory = $ algorithmProviderFactory ;
41
+ }
42
+
34
43
public function create (): AlgorithmManager
35
44
{
36
- return new AlgorithmManager (( new AlgorithmProvider ( self ::ALGOS ) )->getAvailableAlgorithms ());
45
+ return new AlgorithmManager ($ this -> algorithmProviderFactory -> create ( self ::ALGOS )->getAvailableAlgorithms ());
37
46
}
38
47
}
Original file line number Diff line number Diff line change 7
7
-->
8
8
<config xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance" xsi : noNamespaceSchemaLocation =" urn:magento:framework:ObjectManager/etc/config.xsd" >
9
9
<preference for =" Magento\Framework\Jwt\JwtManagerInterface" type =" Magento\JwtFrameworkAdapter\Model\JwtManager" />
10
+ <type name =" Magento\JwtFrameworkAdapter\Model\JweCompressionManagerFactory" >
11
+ <arguments >
12
+ <argument name =" methods" xsi : type =" array" >
13
+ <item name =" deflate" xsi : type =" object" >Jose\Component\Encryption\Compression\Deflate</item >
14
+ </argument >
15
+ </arguments >
16
+ </type >
10
17
</config >
You can’t perform that action at this time.
0 commit comments