Browse Source

DEC-18828 feat: 隔离插件支持kerberos认证前后端交互connectionData中新增useJaas字段

feature/10.0
zsmj1994 4 years ago
parent
commit
f466d42980
  1. 1
      src/modules/crud/crud.typings.d.ts
  2. 44
      src/modules/pages/maintain/forms/components/form.jdbc.ts
  3. 6
      src/modules/pages/maintain/forms/components/form.jndi.ts
  4. 8
      src/modules/pages/maintain/forms/components/form.plugin.ts

1
src/modules/crud/crud.typings.d.ts vendored

@ -1,4 +1,3 @@
export interface CrudReqOpts { export interface CrudReqOpts {
url?: string; url?: string;
type?: 'GET' | 'POST' | 'DELETE' | 'PUT'; type?: 'GET' | 'POST' | 'DELETE' | 'PUT';

44
src/modules/pages/maintain/forms/components/form.jdbc.ts

@ -7,7 +7,16 @@ import { CONNECT_CHARSET, CONNECTION_LAYOUT, INT_MAX_VALUE, INT_MIN_VALUE } from
import {getAllDatabaseTypes, getJdbcDatabaseType, resolveUrlInfo, splitUrl} from '../../../../app.service'; import {getAllDatabaseTypes, getJdbcDatabaseType, resolveUrlInfo, splitUrl} from '../../../../app.service';
import {TextChecker} from '../../../../components/text_checker/text_checker'; import {TextChecker} from '../../../../components/text_checker/text_checker';
import {ApiFactory} from 'src/modules/crud/apiFactory'; import {ApiFactory} from 'src/modules/crud/apiFactory';
import { Editor, EditorIconCheckCombo, Label, TextAreaEditor, TextEditor, TextValueCombo, VerticalLayout } from '@fui/core'; import {
Editor,
EditorIconCheckCombo,
Label,
TextAreaEditor,
TextEditor,
TextValueCombo,
VerticalLayout
} from '@fui/core';
const api = new ApiFactory().create(); const api = new ApiFactory().create();
@shortcut() @shortcut()
@ -58,8 +67,33 @@ export class FormJdbc extends BI.Widget {
render() { render() {
const {connectionName, connectionData} = this.options.formData; const {connectionName, connectionData} = this.options.formData;
const { driver, user, password, originalCharsetName, schema, url, connectionPoolAttr, database, authType, principal, keyPath } = connectionData as ConnectionJDBC; const {
const { initialSize, maxActive, maxIdle, maxWait, validationQuery, testOnBorrow, testOnReturn, testWhileIdle, timeBetweenEvictionRunsMillis, numTestsPerEvictionRun, minIdle, minEvictableIdleTimeMillis } = connectionPoolAttr as ConnectionPoolJDBC; driver,
user,
password,
originalCharsetName,
schema,
url,
connectionPoolAttr,
database,
authType,
principal,
keyPath
} = connectionData as ConnectionJDBC;
const {
initialSize,
maxActive,
maxIdle,
maxWait,
validationQuery,
testOnBorrow,
testOnReturn,
testWhileIdle,
timeBetweenEvictionRunsMillis,
numTestsPerEvictionRun,
minIdle,
minEvictableIdleTimeMillis
} = connectionPoolAttr as ConnectionPoolJDBC;
const databaseType = getJdbcDatabaseType(database, driver); const databaseType = getJdbcDatabaseType(database, driver);
this.oldPassword = password; this.oldPassword = password;
const {host, port, databaseName} = resolveUrlInfo(url, database); const {host, port, databaseName} = resolveUrlInfo(url, database);
@ -766,7 +800,7 @@ export class FormJdbc extends BI.Widget {
connectionType: connectionType.JDBC, connectionType: connectionType.JDBC,
connectionId: this.form.connectionName.getValue(), connectionId: this.form.connectionName.getValue(),
connectionName: this.form.connectionName.getValue(), connectionName: this.form.connectionName.getValue(),
connectionData: { connectionData: <ConnectionJDBC>BI.extend({}, connectionData, {
database: connectionData.database, database: connectionData.database,
connectionName: this.form.connectionName.getValue(), connectionName: this.form.connectionName.getValue(),
driver: this.form.driver.getValue(), driver: this.form.driver.getValue(),
@ -796,7 +830,7 @@ export class FormJdbc extends BI.Widget {
numTestsPerEvictionRun: this.form.numTestsPerEvictionRun.getValue(), numTestsPerEvictionRun: this.form.numTestsPerEvictionRun.getValue(),
minEvictableIdleTimeMillis: this.form.minEvictableIdleTimeMillis.getValue(), minEvictableIdleTimeMillis: this.form.minEvictableIdleTimeMillis.getValue(),
}, },
}, }),
}; };
} }
} }

6
src/modules/pages/maintain/forms/components/form.jndi.ts

@ -400,6 +400,8 @@ export class FormJndi extends BI.Widget {
} }
public getSubmitValue(): Connection { public getSubmitValue(): Connection {
const connectionData = this.options.formData.connectionData as ConnectionJNDI;
const contextHashtable = { const contextHashtable = {
'java.naming.factory.initial': this.form.initial.getValue(), 'java.naming.factory.initial': this.form.initial.getValue(),
'java.naming.provider.url': this.form.providerUrl.getValue(), 'java.naming.provider.url': this.form.providerUrl.getValue(),
@ -428,13 +430,13 @@ export class FormJndi extends BI.Widget {
connectionId: this.form.connectionName.getValue(), connectionId: this.form.connectionName.getValue(),
connectionName: this.form.connectionName.getValue(), connectionName: this.form.connectionName.getValue(),
connectionType: connectionType.JNDI, connectionType: connectionType.JNDI,
connectionData: { connectionData: <ConnectionJNDI>BI.extend({}, connectionData, {
jndiName: this.form.jndiName.getValue(), jndiName: this.form.jndiName.getValue(),
newCharsetName: this.form.newCharsetName.getValue()[0] || '', newCharsetName: this.form.newCharsetName.getValue()[0] || '',
originalCharsetName: this.form.newCharsetName.getValue()[0] || '', originalCharsetName: this.form.newCharsetName.getValue()[0] || '',
creator: Dec ? Dec.personal.username : '', creator: Dec ? Dec.personal.username : '',
contextHashtable: contextHashtable as ContextHashtable, contextHashtable: contextHashtable as ContextHashtable,
}, }),
}; };
} }
} }

8
src/modules/pages/maintain/forms/components/form.plugin.ts

@ -1,5 +1,5 @@
import { shortcut } from '@core/core'; import { shortcut } from '@core/core';
import {Connection} from 'src/modules/crud/crud.typings'; import { Connection, ConnectionPlugin } from 'src/modules/crud/crud.typings';
import { getPluginWidgetEdit } from '../../../../app.service'; import { getPluginWidgetEdit } from '../../../../app.service';
@shortcut() @shortcut()
@ -7,7 +7,7 @@ export class FormPlugin extends BI.Widget {
static xtype = 'dec.dcm.maintain_plugin'; static xtype = 'dec.dcm.maintain_plugin';
props = { props = {
formData: {} as Connection, formData: {} as Connection,
} };
plugin: any; plugin: any;
@ -28,13 +28,13 @@ export class FormPlugin extends BI.Widget {
} }
public getSubmitValue(): Connection { public getSubmitValue(): Connection {
const { connectionType, connectionId, connectionName } = this.options.formData; const { connectionType, connectionId, connectionName, connectionData } = this.options.formData;
return { return {
connectionId, connectionId,
connectionType, connectionType,
connectionName: this.plugin.getConnectionName ? this.plugin.getConnectionName() : connectionName, connectionName: this.plugin.getConnectionName ? this.plugin.getConnectionName() : connectionName,
connectionData: this.plugin.getValue(), connectionData: <ConnectionPlugin>BI.extend({}, connectionData, this.plugin.getValue()),
}; };
} }
} }

Loading…
Cancel
Save