1
0
Fork 0
mirror of synced 2024-08-08 06:37:55 +12:00

Add local AD option

This commit is contained in:
Adria Navarro 2023-07-11 12:35:00 +02:00
parent c3caea39d3
commit 00fff6eded

View file

@ -28,7 +28,8 @@ const DEFAULT_SCHEMA = "dbo"
import { ConfidentialClientApplication } from "@azure/msal-node" import { ConfidentialClientApplication } from "@azure/msal-node"
enum MSSQLConfigAuthType { enum MSSQLConfigAuthType {
ACTIVE_DIRECTORY = "Active Directory", AZURE_ACTIVE_DIRECTORY = "Azure Active Directory",
LOCAL_ACTIVE_DIRECTORY = "Local Active Directory",
} }
interface MSSQLConfig { interface MSSQLConfig {
@ -93,13 +94,18 @@ const SCHEMA: Integration = {
authType: { authType: {
type: DatasourceFieldType.SELECT, type: DatasourceFieldType.SELECT,
display: "Advanced auth", display: "Advanced auth",
config: { options: [MSSQLConfigAuthType.ACTIVE_DIRECTORY] }, config: {
options: [
MSSQLConfigAuthType.AZURE_ACTIVE_DIRECTORY,
MSSQLConfigAuthType.LOCAL_ACTIVE_DIRECTORY,
],
},
}, },
adConfig: { adConfig: {
type: DatasourceFieldType.FIELD_GROUP, type: DatasourceFieldType.FIELD_GROUP,
default: true, default: true,
display: "Configure Active Directory", display: "Configure Active Directory",
hidden: "'{{authType}}' !== 'Active Directory'", hidden: `'{{authType}}' !== '${MSSQLConfigAuthType.AZURE_ACTIVE_DIRECTORY}'`,
config: { config: {
openByDefault: true, openByDefault: true,
nestedFields: true, nestedFields: true,
@ -199,7 +205,7 @@ class SqlServerIntegration extends Sql implements DatasourcePlus {
} }
delete clientCfg.encrypt delete clientCfg.encrypt
if (this.config.authType === MSSQLConfigAuthType.ACTIVE_DIRECTORY) { if (this.config.authType === MSSQLConfigAuthType.AZURE_ACTIVE_DIRECTORY) {
const { clientId, tenantId, clientSecret } = this.config.adConfig! const { clientId, tenantId, clientSecret } = this.config.adConfig!
const clientApp = new ConfidentialClientApplication({ const clientApp = new ConfidentialClientApplication({
auth: { auth: {