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
275275 }
276276}
277277
278+ interface ServerManagerAuthSession extends vscode . AuthenticationSession {
279+ serverName : string ;
280+ userName : string ;
281+ }
282+
278283async function resolvePassword ( serverSpec , ignoreUnauthenticated = false ) : Promise < void > {
279284 if (
280285 // Connection isn't unauthenticated
@@ -287,19 +292,27 @@ async function resolvePassword(serverSpec, ignoreUnauthenticated = false): Promi
287292 // Handle Server Manager extension version < 3.8.0
288293 const account = serverManagerApi . getAccount ? serverManagerApi . getAccount ( serverSpec ) : undefined ;
289294
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 ,
297300 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+ ) ;
299312 }
300313 if ( session ) {
301314 // 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 ;
303316 serverSpec . password = session . accessToken ;
304317 }
305318 }
You can’t perform that action at this time.
0 commit comments