@@ -18,6 +18,7 @@ import { IAuthenticationUsageService } from './authenticationUsageService.js';
18
18
import { AuthenticationSession , IAuthenticationProvider , IAuthenticationService , IAuthenticationExtensionsService , AuthenticationSessionAccount } from '../common/authentication.js' ;
19
19
import { Emitter } from '../../../../base/common/event.js' ;
20
20
import { IProductService } from '../../../../platform/product/common/productService.js' ;
21
+ import { ExtensionIdentifier } from '../../../../platform/extensions/common/extensions.js' ;
21
22
22
23
// OAuth2 spec prohibits space in a scope, so use that to join them.
23
24
const SCOPESLIST_SEPARATOR = ' ' ;
@@ -153,7 +154,8 @@ export class AuthenticationExtensionsService extends Disposable implements IAuth
153
154
//#region Account/Session Preference
154
155
155
156
updateAccountPreference ( extensionId : string , providerId : string , account : AuthenticationSessionAccount ) : void {
156
- const parentExtensionId = this . _inheritAuthAccountPreferenceChildToParent [ extensionId ] ?? extensionId ;
157
+ const realExtensionId = ExtensionIdentifier . toKey ( extensionId ) ;
158
+ const parentExtensionId = this . _inheritAuthAccountPreferenceChildToParent [ realExtensionId ] ?? realExtensionId ;
157
159
const key = this . _getKey ( parentExtensionId , providerId ) ;
158
160
159
161
// Store the preference in the workspace and application storage. This allows new workspaces to
@@ -168,14 +170,16 @@ export class AuthenticationExtensionsService extends Disposable implements IAuth
168
170
}
169
171
170
172
getAccountPreference ( extensionId : string , providerId : string ) : string | undefined {
171
- const key = this . _getKey ( this . _inheritAuthAccountPreferenceChildToParent [ extensionId ] ?? extensionId , providerId ) ;
173
+ const realExtensionId = ExtensionIdentifier . toKey ( extensionId ) ;
174
+ const key = this . _getKey ( this . _inheritAuthAccountPreferenceChildToParent [ realExtensionId ] ?? realExtensionId , providerId ) ;
172
175
173
176
// If a preference is set in the workspace, use that. Otherwise, use the global preference.
174
177
return this . storageService . get ( key , StorageScope . WORKSPACE ) ?? this . storageService . get ( key , StorageScope . APPLICATION ) ;
175
178
}
176
179
177
180
removeAccountPreference ( extensionId : string , providerId : string ) : void {
178
- const key = this . _getKey ( this . _inheritAuthAccountPreferenceChildToParent [ extensionId ] ?? extensionId , providerId ) ;
181
+ const realExtensionId = ExtensionIdentifier . toKey ( extensionId ) ;
182
+ const key = this . _getKey ( this . _inheritAuthAccountPreferenceChildToParent [ realExtensionId ] ?? realExtensionId , providerId ) ;
179
183
180
184
// This won't affect any other workspaces that have a preference set, but it will remove the preference
181
185
// for this workspace and the global preference. This is only paired with a call to updateSessionPreference...
@@ -192,11 +196,12 @@ export class AuthenticationExtensionsService extends Disposable implements IAuth
192
196
// TODO@TylerLeonhardt : Remove all of this after a couple iterations
193
197
194
198
updateSessionPreference ( providerId : string , extensionId : string , session : AuthenticationSession ) : void {
199
+ const realExtensionId = ExtensionIdentifier . toKey ( extensionId ) ;
195
200
// The 3 parts of this key are important:
196
201
// * Extension id: The extension that has a preference
197
202
// * Provider id: The provider that the preference is for
198
203
// * The scopes: The subset of sessions that the preference applies to
199
- const key = `${ extensionId } -${ providerId } -${ session . scopes . join ( SCOPESLIST_SEPARATOR ) } ` ;
204
+ const key = `${ realExtensionId } -${ providerId } -${ session . scopes . join ( SCOPESLIST_SEPARATOR ) } ` ;
200
205
201
206
// Store the preference in the workspace and application storage. This allows new workspaces to
202
207
// have a preference set already to limit the number of prompts that are shown... but also allows
@@ -206,22 +211,24 @@ export class AuthenticationExtensionsService extends Disposable implements IAuth
206
211
}
207
212
208
213
getSessionPreference ( providerId : string , extensionId : string , scopes : string [ ] ) : string | undefined {
214
+ const realExtensionId = ExtensionIdentifier . toKey ( extensionId ) ;
209
215
// The 3 parts of this key are important:
210
216
// * Extension id: The extension that has a preference
211
217
// * Provider id: The provider that the preference is for
212
218
// * The scopes: The subset of sessions that the preference applies to
213
- const key = `${ extensionId } -${ providerId } -${ scopes . join ( SCOPESLIST_SEPARATOR ) } ` ;
219
+ const key = `${ realExtensionId } -${ providerId } -${ scopes . join ( SCOPESLIST_SEPARATOR ) } ` ;
214
220
215
221
// If a preference is set in the workspace, use that. Otherwise, use the global preference.
216
222
return this . storageService . get ( key , StorageScope . WORKSPACE ) ?? this . storageService . get ( key , StorageScope . APPLICATION ) ;
217
223
}
218
224
219
225
removeSessionPreference ( providerId : string , extensionId : string , scopes : string [ ] ) : void {
226
+ const realExtensionId = ExtensionIdentifier . toKey ( extensionId ) ;
220
227
// The 3 parts of this key are important:
221
228
// * Extension id: The extension that has a preference
222
229
// * Provider id: The provider that the preference is for
223
230
// * The scopes: The subset of sessions that the preference applies to
224
- const key = `${ extensionId } -${ providerId } -${ scopes . join ( SCOPESLIST_SEPARATOR ) } ` ;
231
+ const key = `${ realExtensionId } -${ providerId } -${ scopes . join ( SCOPESLIST_SEPARATOR ) } ` ;
225
232
226
233
// This won't affect any other workspaces that have a preference set, but it will remove the preference
227
234
// for this workspace and the global preference. This is only paired with a call to updateSessionPreference...
0 commit comments