@@ -165,7 +165,6 @@ export class ServerManagerAuthenticationProvider implements AuthenticationProvid
165
165
const enteredPassword = inputBox . value ;
166
166
if ( secretStorage && enteredPassword ) {
167
167
await secretStorage . store ( credentialKey , enteredPassword ) ;
168
- console . log ( `Stored password at ${ credentialKey } ` ) ;
169
168
}
170
169
// Resolve the promise and tidy up
171
170
resolve ( enteredPassword ) ;
@@ -270,7 +269,6 @@ export class ServerManagerAuthenticationProvider implements AuthenticationProvid
270
269
if ( deletePassword ) {
271
270
// Delete from secret storage
272
271
await this . secretStorage . delete ( credentialKey ) ;
273
- console . log ( `${ AUTHENTICATION_PROVIDER_LABEL } : Deleted password at ${ credentialKey } ` ) ;
274
272
}
275
273
if ( index > - 1 ) {
276
274
// Remove session here so we don't store it
@@ -280,6 +278,45 @@ export class ServerManagerAuthenticationProvider implements AuthenticationProvid
280
278
this . _onDidChangeSessions . fire ( { added : [ ] , removed : [ session ] , changed : [ ] } ) ;
281
279
}
282
280
281
+ public async removeSessions ( sessionIds : string [ ] ) : Promise < void > {
282
+ const storedPasswordCredKeys : string [ ] = [ ] ;
283
+ const removed : AuthenticationSession [ ] = [ ] ;
284
+ await Promise . allSettled ( sessionIds . map ( async ( sessionId ) => {
285
+ const index = this . _sessions . findIndex ( ( item ) => item . id === sessionId ) ;
286
+ const session = this . _sessions [ index ] ;
287
+ const credentialKey = ServerManagerAuthenticationProvider . credentialKey ( sessionId ) ;
288
+ if ( await this . secretStorage . get ( credentialKey ) !== undefined ) {
289
+ storedPasswordCredKeys . push ( credentialKey ) ;
290
+ }
291
+ if ( index > - 1 ) {
292
+ this . _sessions . splice ( index , 1 ) ;
293
+ }
294
+ removed . push ( session ) ;
295
+ } ) ) ;
296
+ if ( storedPasswordCredKeys . length ) {
297
+ const passwordOption = workspace . getConfiguration ( "intersystemsServerManager.credentialsProvider" )
298
+ . get < string > ( "deletePasswordOnSignout" , "ask" ) ;
299
+ let deletePasswords = ( passwordOption === "always" ) ;
300
+ if ( passwordOption === "ask" ) {
301
+ const choice = await window . showWarningMessage (
302
+ `Do you want to keep the stored passwords or delete them?` ,
303
+ {
304
+ detail : `${ storedPasswordCredKeys . length == sessionIds . length ? "All" : "Some"
305
+ } of the ${ AUTHENTICATION_PROVIDER_LABEL } accounts you signed out are currently storing their passwords securely on your workstation.`, modal : true
306
+ } ,
307
+ { title : "Keep" , isCloseAffordance : true } ,
308
+ { title : "Delete" , isCloseAffordance : false } ,
309
+ ) ;
310
+ deletePasswords = ( choice ?. title === "Delete" ) ;
311
+ }
312
+ if ( deletePasswords ) {
313
+ await Promise . allSettled ( storedPasswordCredKeys . map ( ( e ) => this . secretStorage . delete ( e ) ) ) ;
314
+ }
315
+ }
316
+ await this . _storeStrippedSessions ( ) ;
317
+ this . _onDidChangeSessions . fire ( { added : [ ] , removed, changed : [ ] } ) ;
318
+ }
319
+
283
320
private async _ensureInitialized ( ) : Promise < void > {
284
321
if ( this . _initializedDisposable === undefined ) {
285
322
0 commit comments