Support AD in cluster connection dialog (#7367)

- Use token API to get auth token before using other endpoints. Note this needs server updates before it'll work as expected (will only checkin after verifying this)
- Add auth option in controller UI and plumb through connection save, load, and uses of the controller API
Because the swagger spec is split in 2 created new file for the 2nd swagger spec including token auth endpoints. These come from a running cluster and instructions were updated to reflect this.

New UI Changes:
- Added authentication type field with "Basic" and "Windows Authentication" as the options
- Moved error notifications to the dialog instead of separate notification window. That's the recommended pattern
- Username / password aren't required for Windows Authentication. I couldn't find a way to change required status in form container on switching from Windows => Basic Auth so have error show on clicking OK. 
- Controller URL should use ":" not "," for IP:Port
This commit is contained in:
Kevin Cunnane
2019-09-30 15:59:04 -07:00
committed by GitHub
parent 5327ed84c1
commit 9f065b2b5a
15 changed files with 2244 additions and 107 deletions

View File

@@ -13,11 +13,13 @@ import { AddControllerNode } from './addControllerNode';
import { ControllerRootNode, ControllerNode } from './controllerTreeNode';
import { showErrorMessage } from '../utils';
import { LoadingControllerNode } from './loadingControllerNode';
import { AuthType } from '../constants';
const CredentialNamespace = 'clusterControllerCredentials';
interface IControllerInfoSlim {
url: string;
auth: AuthType;
username: string;
password?: string;
rememberPassword: boolean;
@@ -57,17 +59,18 @@ export class ControllerTreeDataProvider implements vscode.TreeDataProvider<TreeN
public addController(
url: string,
auth: AuthType,
username: string,
password: string,
rememberPassword: boolean
): void {
this.removeNonControllerNodes();
this.root.addControllerNode(url, username, password, rememberPassword);
this.root.addControllerNode(url, auth, username, password, rememberPassword);
this.notifyNodeChanged();
}
public deleteController(url: string, username: string): ControllerNode {
let deleted = this.root.deleteControllerNode(url, username);
public deleteController(url: string, auth: AuthType, username: string): ControllerNode {
let deleted = this.root.deleteControllerNode(url, auth, username);
if (deleted) {
this.notifyNodeChanged();
}
@@ -115,8 +118,12 @@ export class ControllerTreeDataProvider implements vscode.TreeDataProvider<TreeN
if (c.rememberPassword) {
password = await this.getPassword(c.url, c.username);
}
if (!c.auth) {
// Added before we had added authentication
c.auth = 'basic';
}
this.root.addChild(new ControllerNode(
c.url, c.username, password, c.rememberPassword,
c.url, c.auth, c.username, password, c.rememberPassword,
undefined, this.root, this, undefined
));
}
@@ -135,6 +142,7 @@ export class ControllerTreeDataProvider implements vscode.TreeDataProvider<TreeN
let controller = e as ControllerNode;
return {
url: controller.url,
auth: controller.auth,
username: controller.username,
password: controller.password,
rememberPassword: !!controller.rememberPassword
@@ -144,6 +152,7 @@ export class ControllerTreeDataProvider implements vscode.TreeDataProvider<TreeN
let controllersWithoutPassword = controllers.map((e): IControllerInfoSlim => {
return {
url: e.url,
auth: e.auth,
username: e.username,
rememberPassword: e.rememberPassword
};