Skip to content

Commit 255b724

Browse files
committed
fixing
1 parent 5bae510 commit 255b724

3 files changed

Lines changed: 15 additions & 27 deletions

File tree

src/api/index.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,9 @@ export class AtelierAPI {
6767
const superserverPort = this.externalServer
6868
? this._config.superserverPort
6969
: workspaceState.get(wsKey + ":superserverPort", this._config.superserverPort);
70-
const password = workspaceState.get(wsKey + ":password", undefined);
71-
if (password !== undefined) {
72-
auth.resolve({ accessToken: password });
70+
const accessToken = workspaceState.get(wsKey + ":password", undefined);
71+
if (accessToken !== undefined) {
72+
auth.resolve({ accessToken });
7373
}
7474
const apiVersion = workspaceState.get(wsKey + ":apiVersion", DEFAULT_API_VERSION);
7575
const serverVersion = workspaceState.get(wsKey + ":serverVersion", DEFAULT_SERVER_VERSION);
@@ -209,12 +209,12 @@ export class AtelierAPI {
209209

210210
/** Return the key for getting values from connection-specific Maps for this connection */
211211
private mapKey(): string {
212-
const { host, port, auth: authorization } = this.config;
212+
const { host, port, auth } = this.config;
213213
let pathPrefix = this._config.pathPrefix || "";
214214
if (pathPrefix.length && !pathPrefix.startsWith("/")) {
215215
pathPrefix = "/" + pathPrefix;
216216
}
217-
return `${authorization.username}@${host}:${port}${pathPrefix}`;
217+
return `${auth.username}@${host}:${port}${pathPrefix}`;
218218
}
219219

220220
private setConnection(workspaceFolderName: string, namespace?: string): void {
@@ -239,7 +239,7 @@ export class AtelierAPI {
239239
if (serverName !== "") {
240240
const {
241241
webServer: { scheme, host, port, pathPrefix = "" },
242-
authorization,
242+
auth,
243243
superServer,
244244
} = getResolvedConnectionSpec(serverName, config("intersystems.servers", workspaceFolderName).get(serverName));
245245
this._config = {
@@ -252,7 +252,7 @@ export class AtelierAPI {
252252
host,
253253
port,
254254
superserverPort: superServer?.port,
255-
auth: authorization,
255+
auth,
256256
pathPrefix,
257257
docker: false,
258258
};
@@ -262,7 +262,7 @@ export class AtelierAPI {
262262
if (resolvedSpec) {
263263
const {
264264
webServer: { scheme, host, port, pathPrefix = "" },
265-
authorization,
265+
auth,
266266
superServer,
267267
} = resolvedSpec;
268268
this._config = {
@@ -275,7 +275,7 @@ export class AtelierAPI {
275275
host,
276276
port,
277277
superserverPort: superServer?.port,
278-
auth: authorization,
278+
auth,
279279
pathPrefix,
280280
docker: true,
281281
dockerService: conn["docker-compose"].service,

src/commands/restDebugPanel.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -548,8 +548,7 @@ export class RESTDebugPanel {
548548
.trim();
549549
}
550550
});
551-
headers["authorization"] =
552-
headers["authorization"] ?? (api.config.auth.resolved() ? api.config.auth.httpAuthorizationHeader : "");
551+
headers["authorization"] = headers["authorization"] ?? (api.config.auth.httpAuthorizationHeader || "");
553552
const hasBody =
554553
typeof message.bodyContent == "string" && message.bodyContent != "" && message.bodyType != "No Body";
555554
if (hasBody) {

src/extension.ts

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ export async function resolveUsernameAndPassword(
320320
}
321321

322322
/** Accessor for the cache of resolved connection specs */
323-
export function getResolvedConnectionSpec(key: string, dflt: any): any {
323+
export function getResolvedConnectionSpec(key: string, dflt: serverManager.IServerSpec): serverManager.IServerSpec {
324324
let spec = resolvedConnSpecs.get(key);
325325
if (spec) {
326326
return spec;
@@ -1973,19 +1973,8 @@ function serverForUri(uri: vscode.Uri): ServerForUri {
19731973
// This function intentionally no longer exposes the password for a named server UNLESS it is already exposed as plaintext in settings.
19741974
// API client extensions should use Server Manager 3's authentication provider to request a missing password themselves,
19751975
// which will require explicit user consent to divulge the password to the requesting extension.
1976-
const {
1977-
serverName,
1978-
active,
1979-
host,
1980-
https,
1981-
port,
1982-
superserverPort,
1983-
pathPrefix,
1984-
auth: authorization,
1985-
ns,
1986-
apiVersion,
1987-
serverVersion,
1988-
} = api.config;
1976+
const { serverName, active, host, https, port, superserverPort, pathPrefix, auth, ns, apiVersion, serverVersion } =
1977+
api.config;
19891978
if (serverName !== "") {
19901979
const password = vscode.workspace
19911980
.getConfiguration(
@@ -2000,7 +1989,7 @@ function serverForUri(uri: vscode.Uri): ServerForUri {
20001989
)
20011990
.get("password") as string | undefined;
20021991
if (password !== undefined) {
2003-
authorization.resolve({ accessToken: password });
1992+
auth.resolve({ accessToken: password });
20041993
}
20051994
}
20061995
return {
@@ -2011,7 +2000,7 @@ function serverForUri(uri: vscode.Uri): ServerForUri {
20112000
port,
20122001
superserverPort,
20132002
pathPrefix,
2014-
auth: authorization,
2003+
auth: auth,
20152004
namespace: ns,
20162005
apiVersion: active ? apiVersion : undefined,
20172006
serverVersion: active ? serverVersion : undefined,

0 commit comments

Comments
 (0)