in gui/frontend/src/modules/mrs/dialogs/MrsAuthenticationAppDialog.tsx [130:279]
private dialogValues(request: IDialogRequest, authVendors: IMrsAuthVendorData[],
roles: IMrsRoleData[]): IDialogValues {
const appData = (request.values as unknown) as IMrsAuthAppData;
const mainSection: IDialogSection = {
caption: request.title,
values: {
authVendorName: {
type: "choice",
caption: "Vendor",
choices: authVendors ? authVendors.map((authVendor) => {
return authVendor.name;
}) : [],
value: appData.authVendorName,
description: "The authentication vendor",
horizontalSpan: 2,
onChange: (value: DialogValueType, dialog: ValueEditDialog): void => {
if (value as string === "MRS" || value as string === "MySQL Internal") {
dialog.updateActiveContexts({remove: ["oAuth"]});
} else {
dialog.updateActiveContexts({add: ["oAuth"]});
}
},
},
name: {
type: "text",
caption: "Name",
value: appData.name,
description: "The name of the authentication app",
horizontalSpan: 3,
},
flags: {
type: "description",
caption: "Flags",
options: [
CommonDialogValueOption.Grouped,
CommonDialogValueOption.NewGroup,
],
horizontalSpan: 3,
},
enabled: {
type: "boolean",
caption: "Enabled",
value: appData.enabled,
options: [
CommonDialogValueOption.Grouped,
],
horizontalSpan: 3,
},
limitToRegisteredUsers: {
type: "boolean",
caption: "Limit to registered users",
value: appData.limitToRegisteredUsers,
options: [
CommonDialogValueOption.Grouped,
],
horizontalSpan: 3,
},
},
};
const settingsSection: IDialogSection = {
caption: "Settings",
groupName: "group1",
values: {
description: {
type: "text",
caption: "Description",
value: appData.description,
description: "A short description of the app",
horizontalSpan: 5,
multiLine: true,
multiLineCount: 8,
},
defaultRoleName: {
type: "choice",
caption: "Default Role",
choices: roles ? roles.map((role) => {
return role.caption;
}) : [],
value: appData.defaultRoleId ?? "",
description: "The default role for users",
optional: true,
horizontalSpan: 3,
},
},
};
const oAuthSection: IDialogSection = {
contexts: ["oAuth"],
caption: "OAuth2 Settings",
groupName: "group1",
values: {
url: {
type: "text",
caption: "Custom URL",
value: appData.url,
description: "A custom OAuth2 service URL",
horizontalSpan: 8,
},
appId: {
type: "text",
caption: "App ID",
value: appData.appId,
description: "The OAuth2 App ID/Client ID for this app as defined by the vendor",
horizontalSpan: 4,
},
accessToken: {
type: "text",
caption: "App Secret",
value: appData.accessToken,
description: "The OAuth2 App Secret/Client Secret for this app as defined by the vendor",
horizontalSpan: 4,
obfuscated: true,
},
urlDirectAuth: {
type: "text",
caption: "Custom URL for Access Token",
value: appData.urlDirectAuth,
description: "A custom URL for exchanging the Access Token",
horizontalSpan: 8,
},
},
};
const optionsSection: IDialogSection = {
caption: "Options",
groupName: "group1",
values: {
options: {
type: "text",
caption: "Options",
value: request.values?.options as string,
horizontalSpan: 8,
multiLine: true,
multiLineCount: 8,
description: "Additional options in JSON format",
},
},
};
return {
id: "mainSection",
sections: new Map<string, IDialogSection>([
["mainSection", mainSection],
["oAuthSection", oAuthSection],
["settingsSection", settingsSection],
["optionsSection", optionsSection],
]),
};
}