Skip to content

Commit 92604b3

Browse files
committed
Remove obsolete code missed by #190
1 parent 518946e commit 92604b3

File tree

4 files changed

+11
-27
lines changed

4 files changed

+11
-27
lines changed

src/api/getServerSpec.ts

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,17 @@
11
import * as vscode from "vscode";
22
import { IServerSpec } from "@intersystems-community/intersystems-servermanager";
33

4-
interface ICredentialSet {
5-
username: string;
6-
password: string;
7-
}
8-
9-
export let credentialCache = new Map<string, ICredentialSet>();
10-
114
/**
125
* Get a server specification.
136
*
147
* @param name The name.
158
* @param scope The settings scope to use for the lookup.
16-
* @param flushCredentialCache Flush the session's cache of credentials obtained from keystore and/or user prompting.
17-
* @param noCredentials Set username and password as undefined; do not fetch credentials from anywhere.
189
* @returns Server specification or undefined.
1910
*/
2011
export async function getServerSpec(
2112
name: string,
2213
scope?: vscode.ConfigurationScope,
23-
flushCredentialCache: boolean = false,
24-
noCredentials: boolean = false,
2514
): Promise<IServerSpec | undefined> {
26-
if (flushCredentialCache) {
27-
credentialCache[name] = undefined;
28-
}
2915
// To avoid breaking existing users, continue to return a default server definition even after we dropped that feature
3016
let server: IServerSpec | undefined = vscode.workspace.getConfiguration("intersystems.servers", scope).get(name) || legacyEmbeddedServer(name);
3117

src/extension.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ export function activate(context: vscode.ExtensionContext) {
254254
if (pathParts && pathParts.length === 4) {
255255
const serverName = pathParts[1];
256256
const namespace = pathParts[3];
257-
const serverSpec = await getServerSpec(serverName, undefined, undefined, true);
257+
const serverSpec = await getServerSpec(serverName);
258258
if (serverSpec) {
259259
const ISFS_ID = "intersystems-community.vscode-objectscript";
260260
const isfsExtension = vscode.extensions.getExtension(ISFS_ID);
@@ -379,28 +379,28 @@ export function activate(context: vscode.ExtensionContext) {
379379
/**
380380
* Get specification for the named server.
381381
*
382-
* If the `"intersystemsServerManager.authentication.provider"` setting is "intersystems-server-credentials":
383-
* - the returned object will not contain `password`. To get this:
382+
* The returned object will not contain `password`. To get that:
384383
* ```
385-
* const session = await vscode.authentication.getSession('intersystems-server-credentials', [serverSpec.name, serverSpec.username]);
384+
* const session: vscode.AuthenticationSession = await vscode.authentication.getSession('intersystems-server-credentials', [serverSpec.name, serverSpec.username]);
386385
* ```
387386
* The `accessToken` property of the returned [`AuthenticationSession`](https://code.visualstudio.com/api/references/vscode-api#AuthenticationSession) is the password.
388-
* - `flushCredentialsCache` param will be ignored;
389-
* - `noCredentials` property of `options` param has no effect;
387+
*
388+
* The `flushCredentialsCache` param is obsolete and has no effect;
389+
* The `noCredentials` property of `options` param is obsolete and has no effect;
390390
*
391391
* @param name Name of the server, used as the key into the 'intersystems.servers' settings object
392392
* @param scope Settings scope to look in.
393-
* @param flushCredentialCache If passed as true, flush extension's credential cache.
393+
* @param flushCredentialCache Obsolete, has no effect.
394394
* @param options
395395
* @returns { IServerSpec } Server specification object.
396396
*/
397397
async getServerSpec(
398398
name: string,
399399
scope?: vscode.ConfigurationScope,
400400
flushCredentialCache: boolean = false,
401-
options?: { hideFromRecents?: boolean, noCredentials?: boolean },
401+
options?: { hideFromRecents?: boolean, /* Obsolete */ noCredentials?: boolean },
402402
): Promise<IServerSpec | undefined> {
403-
const spec = await getServerSpec(name, scope, flushCredentialCache, options?.noCredentials);
403+
const spec = await getServerSpec(name, scope);
404404
if (spec && !options?.hideFromRecents) {
405405
await view.addToRecents(name);
406406
}

src/makeRESTRequest.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ export async function makeRESTRequest(
176176
*/
177177
export async function logout(serverName: string) {
178178

179-
const server = await getServerSpec(serverName, undefined, false, true);
179+
const server = await getServerSpec(serverName, undefined);
180180

181181
if (!server) {
182182
return;

src/ui/serverManagerView.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as vscode from "vscode";
22
import { getServerNames } from "../api/getServerNames";
3-
import { credentialCache, getServerSpec } from "../api/getServerSpec";
3+
import { getServerSpec } from "../api/getServerSpec";
44
import { getServerSummary } from "../api/getServerSummary";
55
import { IServerName } from "@intersystems-community/intersystems-servermanager";
66
import { makeRESTRequest } from "../makeRESTRequest";
@@ -386,7 +386,6 @@ async function serverFeatures(element: ServerTreeItem, params?: any): Promise<Fe
386386
const response = await makeRESTRequest("HEAD", serverSpec);
387387
if (!response || response.status !== 200) {
388388
children.push(new OfflineTreeItem({ parent: element, label: name, id: name }, serverSpec.username || 'UnknownUser'));
389-
credentialCache[name] = undefined;
390389
} else {
391390
children.push(new NamespacesTreeItem({ parent: element, label: name, id: name }, element.name, serverSpec.username || 'UnknownUser'));
392391
}
@@ -461,7 +460,6 @@ async function serverNamespaces(element: ServerTreeItem, params?: any): Promise<
461460
const response = await makeRESTRequest("GET", serverSpec);
462461
if (!response || response.status !== 200) {
463462
children.push(new OfflineTreeItem({ parent: element, label: name, id: name }, serverSpec.username || 'UnknownUser'));
464-
credentialCache[params.serverName] = undefined;
465463
} else {
466464
const serverApiVersion = response.data.result.content.api;
467465
response.data.result.content.namespaces.map((namespace) => {

0 commit comments

Comments
 (0)