mirror of
https://github.com/microsoft/vscode.git
synced 2026-09-20 02:34:37 +01:00
Make sure auth provider id is alligned (#251432)
Fixes https://github.com/microsoft/vscode/issues/251418
This commit is contained in:
@@ -121,7 +121,8 @@ export class MainThreadAuthentication extends Disposable implements MainThreadAu
|
||||
// Prefer Node.js extension hosts when they're available. No CORS issues etc.
|
||||
priority: extHostContext.extensionHostKind === ExtensionHostKind.LocalWebWorker ? 0 : 1,
|
||||
create: async (authorizationServer, serverMetadata, resource) => {
|
||||
const authProviderId = authorizationServer.toString(true);
|
||||
// Auth Provider Id is a combination of the authorization server and the resource, if provided.
|
||||
const authProviderId = resource ? `${authorizationServer.toString(true)} ${resource.resource}` : authorizationServer.toString(true);
|
||||
const clientId = this.dynamicAuthProviderStorageService.getClientId(authProviderId);
|
||||
let initialTokens: (IAuthorizationTokenResponse & { created_at: number })[] | undefined = undefined;
|
||||
if (clientId) {
|
||||
|
||||
@@ -284,12 +284,14 @@ export class DynamicAuthProvider implements vscode.AuthenticationProvider {
|
||||
initialTokens: IAuthorizationToken[],
|
||||
) {
|
||||
const stringifiedServer = authorizationServer.toString(true);
|
||||
// Auth Provider Id is a combination of the authorization server and the resource, if provided.
|
||||
this.id = _resourceMetadata?.resource
|
||||
? stringifiedServer + ' ' + _resourceMetadata?.resource
|
||||
: stringifiedServer;
|
||||
// Auth Provider label is just the resource name if provided, otherwise the authority of the authorization server.
|
||||
this.label = _resourceMetadata?.resource_name ?? this.authorizationServer.authority;
|
||||
|
||||
this._logger = loggerService.createLogger(stringifiedServer, { name: this.label });
|
||||
this._logger = loggerService.createLogger(this.id, { name: this.label });
|
||||
this._disposable = new DisposableStore();
|
||||
this._disposable.add(this._onDidChangeSessions);
|
||||
const scopedEvent = Event.chain(onDidDynamicAuthProviderTokensChange.event, $ => $
|
||||
@@ -299,7 +301,7 @@ export class DynamicAuthProvider implements vscode.AuthenticationProvider {
|
||||
this._tokenStore = this._disposable.add(new TokenStore(
|
||||
{
|
||||
onDidChange: scopedEvent,
|
||||
set: (tokens) => _proxy.$setSessionsForDynamicAuthProvider(stringifiedServer, this.clientId, tokens),
|
||||
set: (tokens) => _proxy.$setSessionsForDynamicAuthProvider(this.id, this.clientId, tokens),
|
||||
},
|
||||
initialTokens,
|
||||
this._logger
|
||||
|
||||
Reference in New Issue
Block a user