Skip to content

Commit cd563e9

Browse files
committed
Trim token value from Clipboard
Also the sha256-token validation is fixed Signed-off-by: Victor Rubezhny <vrubezhny@redhat.com>
1 parent f3ac0c2 commit cd563e9

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/openshift/cluster.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1027,7 +1027,7 @@ export class Cluster extends OpenShiftItem {
10271027
}
10281028

10291029
static validateLoginToken(token: string): boolean {
1030-
const sha256Regex = new RegExp('^sha256~([A-Za-z0-9_]+)');
1030+
const sha256Regex = new RegExp('^sha256~([A-Za-z0-9_]+)$');
10311031
return sha256Regex.test(token);
10321032
}
10331033

src/webview/cluster/clusterViewLoader.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ async function clusterEditorMessageListener (event: any ): Promise<any> {
117117
if (signupStatus.status.ready) {
118118
const oauthInfo = await sandboxAPI.getOauthServerInfo(signupStatus.apiEndpoint);
119119
let errCode = '';
120-
if (!Cluster.validateLoginToken(await vscode.env.clipboard.readText())) {
120+
if (!Cluster.validateLoginToken((await vscode.env.clipboard.readText()).trim())) {
121121
errCode = 'invalidToken';
122122
}
123123
await panel.webview.postMessage({ action: 'sandboxPageProvisioned', statusInfo: signupStatus.username, consoleDashboard: signupStatus.consoleURL, apiEndpoint: signupStatus.apiEndpoint, oauthTokenEndpoint: oauthInfo.token_endpoint, errorCode: errCode });

0 commit comments

Comments
 (0)