Skip to content

Commit bd2aa0c

Browse files
Fix key string generation (microsoft#273188)
Wanna get this in to unblock azure folks. Fixes microsoft#273176
1 parent 2ca79c4 commit bd2aa0c

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

src/vs/workbench/api/common/extHostAuthentication.ts

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,27 @@ export class ExtHostAuthentication implements ExtHostAuthenticationShape {
8686
async getSession(requestingExtension: IExtensionDescription, providerId: string, scopesOrRequest: readonly string[] | vscode.AuthenticationWwwAuthenticateRequest, options: vscode.AuthenticationGetSessionOptions = {}): Promise<vscode.AuthenticationSession | undefined> {
8787
const extensionId = ExtensionIdentifier.toKey(requestingExtension.identifier);
8888
const keys: (keyof vscode.AuthenticationGetSessionOptions)[] = Object.keys(options) as (keyof vscode.AuthenticationGetSessionOptions)[];
89-
const optionsStr = keys.sort().map(key => `${key}:${!!options[key]}`).join(', ');
89+
// TODO: pull this out into a utility function somewhere
90+
const optionsStr = keys
91+
.map(key => {
92+
switch (key) {
93+
case 'account':
94+
return `${key}:${options.account?.id}`;
95+
case 'createIfNone':
96+
case 'forceNewSession': {
97+
const value = typeof options[key] === 'boolean'
98+
? `${options[key]}`
99+
: `'${options[key]?.detail}/${options[key]?.learnMore?.toString()}'`;
100+
return `${key}:${value}`;
101+
}
102+
case 'authorizationServer':
103+
return `${key}:${options.authorizationServer?.toString(true)}`;
104+
default:
105+
return `${key}:${!!options[key]}`;
106+
}
107+
})
108+
.sort()
109+
.join(', ');
90110

91111
let singlerKey: string;
92112
if (isAuthenticationWwwAuthenticateRequest(scopesOrRequest)) {

0 commit comments

Comments
 (0)