File tree Expand file tree Collapse file tree 4 files changed +66
-20
lines changed
src/Magento/FunctionalTestingFramework/DataGenerator/Handlers/SecretStorage Expand file tree Collapse file tree 4 files changed +66
-20
lines changed Original file line number Diff line number Diff line change 14
14
"allure-framework/allure-codeception" : " ~1.3.0" ,
15
15
"codeception/codeception" : " ~2.3.4 || ~2.4.0 " ,
16
16
"consolidation/robo" : " ^1.0.0" ,
17
- "csharpru/vault-php" : " ^3.6 " ,
17
+ "csharpru/vault-php" : " ~3.5.3 " ,
18
18
"csharpru/vault-php-guzzle6-transport" : " ^2.0" ,
19
19
"flow/jsonpath" : " >0.2" ,
20
20
"fzaninotto/faker" : " ^1.6" ,
Original file line number Diff line number Diff line change 9
9
use Magento \FunctionalTestingFramework \Config \MftfApplicationConfig ;
10
10
use Magento \FunctionalTestingFramework \Exceptions \TestFrameworkException ;
11
11
use Magento \FunctionalTestingFramework \Util \Logger \LoggingUtil ;
12
- use Vault \AuthenticationStrategies \TokenAuthenticationStrategy ;
13
12
use Vault \Client ;
14
13
use VaultTransports \Guzzle6Transport ;
15
14
@@ -111,7 +110,7 @@ private function authenticated()
111
110
try {
112
111
// Authenticating using token auth backend
113
112
$ authenticated = $ this ->client
114
- ->setAuthenticationStrategy (new TokenAuthenticationStrategy ($ this ->token ))
113
+ ->setAuthenticationStrategy (new VaultTokenAuthStrategy ($ this ->token ))
115
114
->authenticate ();
116
115
117
116
if ($ authenticated ) {
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
+ namespace Magento \FunctionalTestingFramework \DataGenerator \Handlers \SecretStorage ;
8
+
9
+ use Magento \FunctionalTestingFramework \Exceptions \TestFrameworkException ;
10
+ use Vault \AuthenticationStrategies \AbstractAuthenticationStrategy ;
11
+ use Vault \ResponseModels \Auth ;
12
+
13
+ /**
14
+ * Class VaultTokenAuthStrategy
15
+ */
16
+ class VaultTokenAuthStrategy extends AbstractAuthenticationStrategy
17
+ {
18
+ /**
19
+ * @var string
20
+ */
21
+ protected $ token ;
22
+
23
+ /**
24
+ * VaultTokenAuthStrategy constructor
25
+ *
26
+ * @param string $token
27
+ */
28
+ public function __construct ($ token )
29
+ {
30
+ $ this ->token = $ token ;
31
+ }
32
+
33
+ /**
34
+ * Returns auth for further interactions with Vault
35
+ *
36
+ * @return Auth
37
+ * @throws TestFrameworkException
38
+ */
39
+ public function authenticate ()
40
+ {
41
+ try {
42
+ return new Auth (['clientToken ' => $ this ->token ]);
43
+ } catch (\Exception $ e ) {
44
+ throw new TestFrameworkException ("Cannot authenticate Vault token. " );
45
+ }
46
+ }
47
+ }
You can’t perform that action at this time.
0 commit comments