File tree Expand file tree Collapse file tree 1 file changed +22
-9
lines changed Expand file tree Collapse file tree 1 file changed +22
-9
lines changed Original file line number Diff line number Diff line change @@ -275,6 +275,11 @@ export async function resolveConnectionSpec(serverName: string, uri?: vscode.Uri
275
275
}
276
276
}
277
277
278
+ interface ServerManagerAuthSession extends vscode . AuthenticationSession {
279
+ serverName : string ;
280
+ userName : string ;
281
+ }
282
+
278
283
async function resolvePassword ( serverSpec , ignoreUnauthenticated = false ) : Promise < void > {
279
284
if (
280
285
// Connection isn't unauthenticated
@@ -287,19 +292,27 @@ async function resolvePassword(serverSpec, ignoreUnauthenticated = false): Promi
287
292
// Handle Server Manager extension version < 3.8.0
288
293
const account = serverManagerApi . getAccount ? serverManagerApi . getAccount ( serverSpec ) : undefined ;
289
294
290
- let session = await vscode . authentication . getSession ( serverManager . AUTHENTICATION_PROVIDER , scopes , {
291
- silent : true ,
292
- account,
293
- } ) ;
294
- if ( ! session ) {
295
- session = await vscode . authentication . getSession ( serverManager . AUTHENTICATION_PROVIDER , scopes , {
296
- createIfNone : true ,
295
+ let session = < ServerManagerAuthSession > await vscode . authentication . getSession (
296
+ serverManager . AUTHENTICATION_PROVIDER ,
297
+ scopes ,
298
+ {
299
+ silent : true ,
297
300
account,
298
- } ) ;
301
+ }
302
+ ) ;
303
+ if ( ! session ) {
304
+ session = < ServerManagerAuthSession > await vscode . authentication . getSession (
305
+ serverManager . AUTHENTICATION_PROVIDER ,
306
+ scopes ,
307
+ {
308
+ createIfNone : true ,
309
+ account,
310
+ }
311
+ ) ;
299
312
}
300
313
if ( session ) {
301
314
// If original spec lacked username use the one obtained by the authprovider
302
- serverSpec . username = serverSpec . username || session . scopes [ 1 ] ;
315
+ serverSpec . username = serverSpec . username || session . userName ;
303
316
serverSpec . password = session . accessToken ;
304
317
}
305
318
}
You can’t perform that action at this time.
0 commit comments