File tree Expand file tree Collapse file tree 1 file changed +19
-16
lines changed
Expand file tree Collapse file tree 1 file changed +19
-16
lines changed Original file line number Diff line number Diff line change @@ -113,17 +113,6 @@ class OpenStack extends \OpenCloud\Base {
113113 $ overlimit_timeout =RAXSDK_OVERLIMIT_TIMEOUT ;
114114
115115 private
116- $ template = <<<ENDAUTHTEMPLATE
117- {
118- "auth": {
119- "passwordCredentials": {
120- "username":"%s",
121- "password":"%s"
122- }
123- }
124- }
125- ENDAUTHTEMPLATE
126- ,
127116 $ _user_write_progress_callback_func ,
128117 $ _user_read_progress_callback_func ,
129118 /**
@@ -261,11 +250,25 @@ ENDAUTHTEMPLATE
261250 */
262251 public function Credentials () {
263252 if (isset ($ this ->secret ['username ' ]) &&
264- isset ($ this ->secret ['password ' ]))
265- return sprintf (
266- $ this ->template ,
267- $ this ->secret ['username ' ],
268- $ this ->secret ['password ' ]);
253+ isset ($ this ->secret ['password ' ]))
254+ {
255+ $ credentials =
256+ array ( 'auth ' =>
257+ array ( 'passwordCredentials ' =>
258+ array (
259+ 'username ' => $ this ->secret ['username ' ],
260+ 'password ' =>$ this ->secret ['password ' ]
261+ )
262+ )
263+ );
264+
265+ if (isset ($ this ->secret ['tenantName ' ]))
266+ {
267+ $ credentials ['auth ' ]['tenantName ' ] = $ this ->secret ['tenantName ' ];
268+ }
269+
270+ return json_encode ($ credentials );
271+ }
269272 else
270273 throw new CredentialError (
271274 _ ('Unrecognized credential secret ' ));
You can’t perform that action at this time.
0 commit comments