support specifying windows domain #305

This commit is contained in:
Jan Prochazka 2022-07-16 11:41:08 +02:00
parent 01d1f08597
commit c368ad8d54
3 changed files with 11 additions and 3 deletions

View File

@ -164,6 +164,10 @@
/> />
{/if} {/if}
{#if driver?.showConnectionField('windowsDomain', $values)}
<FormTextField label="Domain (specify to use NTLM authentication)" name="windowsDomain" disabled={isConnected} />
{/if}
{#if driver?.showConnectionField('isReadOnly', $values)} {#if driver?.showConnectionField('isReadOnly', $values)}
<FormCheckboxField label="Is read only" name="isReadOnly" disabled={isConnected} /> <FormCheckboxField label="Is read only" name="isReadOnly" disabled={isConnected} />
{/if} {/if}

View File

@ -22,7 +22,7 @@ function extractTediousColumns(columns, addDriverNativeColumn = false) {
return res; return res;
} }
async function tediousConnect({ server, port, user, password, database, ssl, trustServerCertificate }) { async function tediousConnect({ server, port, user, password, database, ssl, trustServerCertificate, windowsDomnain }) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
const connectionOptions = { const connectionOptions = {
encrypt: !!ssl, encrypt: !!ssl,
@ -43,10 +43,11 @@ async function tediousConnect({ server, port, user, password, database, ssl, tru
server, server,
authentication: { authentication: {
type: 'default', type: windowsDomnain ? 'ntlm' : 'default',
options: { options: {
userName: user, userName: user,
password: password, password: password,
...(windowsDomnain ? { domain: windowsDomnain } : {}),
}, },
}, },

View File

@ -127,13 +127,16 @@ const driver = {
['authType', 'server', 'port', 'user', 'password', 'defaultDatabase', 'singleDatabase', 'isReadOnly'].includes( ['authType', 'server', 'port', 'user', 'password', 'defaultDatabase', 'singleDatabase', 'isReadOnly'].includes(
field field
) || ) ||
(field == 'trustServerCertificate' && values.authType != 'sql' && values.authType != 'sspi'), (field == 'trustServerCertificate' && values.authType != 'sql' && values.authType != 'sspi') ||
(field == 'windowsDomain' && values.authType != 'sql' && values.authType != 'sspi'),
// (field == 'useDatabaseUrl' && values.authType != 'sql' && values.authType != 'sspi')
getQuerySplitterOptions: () => mssqlSplitterOptions, getQuerySplitterOptions: () => mssqlSplitterOptions,
engine: 'mssql@dbgate-plugin-mssql', engine: 'mssql@dbgate-plugin-mssql',
title: 'Microsoft SQL Server', title: 'Microsoft SQL Server',
defaultPort: 1433, defaultPort: 1433,
defaultAuthTypeName: 'tedious', defaultAuthTypeName: 'tedious',
// databaseUrlPlaceholder: 'e.g. server=localhost&authentication.type=default&authentication.type.user=myuser&authentication.type.password=pwd&options.database=mydb',
getNewObjectTemplates() { getNewObjectTemplates() {
return [ return [