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 99namespace Magento \JwtFrameworkAdapter \Model ;
1010
1111use Jose \Component \Core \AlgorithmManager ;
12- use Jose \Easy \AlgorithmProvider ;
1312
1413class JweAlgorithmManagerFactory
1514{
@@ -32,8 +31,17 @@ class JweAlgorithmManagerFactory
3231 \Jose \Component \Encryption \Algorithm \KeyEncryption \PBES2HS512A256KW ::class
3332 ];
3433
34+ /**
35+ * @var AlgorithmProviderFactory
36+ */
37+ private $ algorithmProviderFactory ;
38+
39+ public function __construct (AlgorithmProviderFactory $ algorithmProviderFactory ) {
40+ $ this ->algorithmProviderFactory = $ algorithmProviderFactory ;
41+ }
42+
3543 public function create (): AlgorithmManager
3644 {
37- return new AlgorithmManager (( new AlgorithmProvider ( self ::ALGOS ) )->getAvailableAlgorithms ());
45+ return new AlgorithmManager ($ this -> algorithmProviderFactory -> create ( self ::ALGOS )->getAvailableAlgorithms ());
3846 }
3947}
Original file line number Diff line number Diff line change 99namespace Magento \JwtFrameworkAdapter \Model ;
1010
1111use Jose \Component \Encryption \Compression \CompressionMethodManager ;
12- use Jose \Component \Encryption \Compression \Deflate ;
1312
1413class JweCompressionManagerFactory
1514{
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+
1628 public function create (): CompressionMethodManager
1729 {
18- return new CompressionMethodManager ([ new Deflate ()] );
30+ return new CompressionMethodManager ($ this -> methods );
1931 }
2032}
Original file line number Diff line number Diff line change 99namespace Magento \JwtFrameworkAdapter \Model ;
1010
1111use Jose \Component \Core \AlgorithmManager ;
12- use Jose \Easy \AlgorithmProvider ;
1312
1413class JweContentAlgorithmManagerFactory
1514{
@@ -22,8 +21,17 @@ class JweContentAlgorithmManagerFactory
2221 \Jose \Component \Encryption \Algorithm \ContentEncryption \A256GCM ::class,
2322 ];
2423
24+ /**
25+ * @var AlgorithmProviderFactory
26+ */
27+ private $ algorithmProviderFactory ;
28+
29+ public function __construct (AlgorithmProviderFactory $ algorithmProviderFactory ) {
30+ $ this ->algorithmProviderFactory = $ algorithmProviderFactory ;
31+ }
32+
2533 public function create (): AlgorithmManager
2634 {
27- return new AlgorithmManager (( new AlgorithmProvider ( self ::ALGOS ) )->getAvailableAlgorithms ());
35+ return new AlgorithmManager ($ this -> algorithmProviderFactory -> create ( self ::ALGOS )->getAvailableAlgorithms ());
2836 }
2937}
Original file line number Diff line number Diff line change @@ -31,8 +31,17 @@ class JwsAlgorithmManagerFactory
3131 \Jose \Component \Signature \Algorithm \None::class
3232 ];
3333
34+ /**
35+ * @var AlgorithmProviderFactory
36+ */
37+ private $ algorithmProviderFactory ;
38+
39+ public function __construct (AlgorithmProviderFactory $ algorithmProviderFactory ) {
40+ $ this ->algorithmProviderFactory = $ algorithmProviderFactory ;
41+ }
42+
3443 public function create (): AlgorithmManager
3544 {
36- return new AlgorithmManager (( new AlgorithmProvider ( self ::ALGOS ) )->getAvailableAlgorithms ());
45+ return new AlgorithmManager ($ this -> algorithmProviderFactory -> create ( self ::ALGOS )->getAvailableAlgorithms ());
3746 }
3847}
Original file line number Diff line number Diff line change 77-->
88<config xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance" xsi : noNamespaceSchemaLocation =" urn:magento:framework:ObjectManager/etc/config.xsd" >
99 <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 >
1017</config >
You can’t perform that action at this time.
0 commit comments