-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
61396c0
commit 7c4b697
Showing
8 changed files
with
303 additions
and
15 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import * as vscode from 'vscode'; | ||
import { Uri } from 'vscode'; | ||
import { getServerSpec } from './getServerSpec'; | ||
|
||
export async function getPortalUriWithCredentials(name: string, scope?: vscode.ConfigurationScope): Promise<Uri | undefined> { | ||
return getServerSpec(name, scope).then((spec) => { | ||
if (typeof spec !== 'undefined') { | ||
const webServer = spec.webServer; | ||
let queryString = ''; | ||
|
||
// At this point we don't know if the target is IRIS or Cache, so add credentials in both formats. | ||
// Deliberately put password before username, otherwise it is visible in VS Code's confirmation dialog triggered target domain | ||
// hasn't been set as trusted. Likewise, deliberately put IRIS* after Cache* | ||
if (spec?.password) { | ||
const passwordEncoded = encodeURIComponent(spec.password); | ||
queryString += `&CachePassword=${passwordEncoded}&IRISPassword=${passwordEncoded}`; | ||
} | ||
if (spec?.username) { | ||
const usernameEncoded = encodeURIComponent(spec.username); | ||
queryString += `&CacheUsername=${usernameEncoded}&IRISUsername=${usernameEncoded}`; | ||
} | ||
|
||
// Push the credentials offscreen | ||
queryString = '_=' + ' '.padStart(500,' ') + queryString; | ||
|
||
return vscode.Uri.parse(`${webServer.scheme}://${webServer.host}:${webServer.port}${webServer.pathPrefix}/csp/sys/UtilHome.csp?${queryString}`, true); | ||
} | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.