Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
chore: rename auth source to authentication database (#4088)
h3n4le9a93d0547d4
diff --git a/api/data_source.go b/api/data_source.goindex be08dcccb4..36c053c20a 100644--- a/api/data_source.go+++ b/api/data_source.go@@ -45,15 +45,15 @@ const (type DataSourceOptions struct {// SRV is used for MongoDB only.SRV bool `json:"srv" jsonapi:"attr,srv"`- // AuthSource is used for MongoDB only.- AuthSource string `json:"authSource" jsonapi:"attr,authSource"`+ // AuthenticationDatabase is used for MongoDB only.+ AuthenticationDatabase string `json:"authenticationDatabase" jsonapi:"attr,authenticationDatabase"`}// getDefaultDataSourceOptions returns the default data source options.func getDefaultDataSourceOptions() DataSourceOptions {return DataSourceOptions{- SRV: false,- AuthSource: "",+ SRV: false,+ AuthenticationDatabase: "",}}diff --git a/api/instance.go b/api/instance.goindex aade3618cb..c7a4db64f0 100644--- a/api/instance.go+++ b/api/instance.go@@ -62,8 +62,8 @@ type InstanceCreate struct {// SRV record is used for MongoDB only.SRV bool `jsonapi:"attr,srv"`- // AuthSource is used for MongoDB only.- AuthSource string `jsonapi:"attr,authSource"`+ // AuthenticationDatabase is used for MongoDB only.+ AuthenticationDatabase string `jsonapi:"attr,authenticationDatabase"`}// InstanceFind is the API message for finding instances.@@ -105,8 +105,8 @@ type InstancePatch struct {ExternalLink *string `jsonapi:"attr,externalLink"`// SRV record is used for MongoDB only.SRV bool `jsonapi:"attr,srv"`- // AuthSource is used for MongoDB only.- AuthSource string `json:"authSource" jsonapi:"attr,authSource"`+ // AuthenticationDatabase is used for MongoDB only.+ AuthenticationDatabase string `json:"authenticationDatabase" jsonapi:"attr,authenticationDatabase"`}// DataSourceFromInstanceWithType gets a typed data source from an instance.diff --git a/api/sql.go b/api/sql.goindex 085b560c5f..645e7f2249 100644--- a/api/sql.go+++ b/api/sql.go@@ -22,8 +22,8 @@ type ConnectionInfo struct {SslKey *string `jsonapi:"attr,sslKey"`// SRV is used for MongoDB only.SRV bool `jsonapi:"attr,srv"`- // AuthSource is used for MongoDB only.- AuthSource string `json:"authSource" jsonapi:"attr,authSource"`+ // AuthenticationDatabase is used for MongoDB only.+ AuthenticationDatabase string `json:"authenticationDatabase" jsonapi:"attr,authenticationDatabase"`}// SQLSyncSchema is the API message for sync schemas.diff --git a/frontend/src/components/CreateInstanceForm.vue b/frontend/src/components/CreateInstanceForm.vueindex 314dc55ed8..c3acc1f202 100644--- a/frontend/src/components/CreateInstanceForm.vue+++ b/frontend/src/components/CreateInstanceForm.vue@@ -198,21 +198,24 @@/></div>- <div v-if="showAuthSource" class="sm:col-span-1 sm:col-start-1">+ <div+ v-if="showAuthenticationDatabase"+ class="sm:col-span-1 sm:col-start-1"+ ><div class="flex flex-row items-center space-x-2">- <label for="authSource" class="textlabel block">- Auth Source+ <label for="authenticationDatabase" class="textlabel block">+ {{ $t("instance.authentication-database") }}</label></div><input- id="authSource"- name="authSource"+ id="authenticationDatabase"+ name="authenticationDatabase"type="text"class="textfield mt-1 w-full"autocomplete="off"placeholder="admin"- :value="state.instance.authSource"- @input="handleInstanceAuthSourceInput"+ :value="state.instance.authenticationDatabase"+ @input="handleInstanceAuthenticationDatabaseInput"/></div>@@ -366,7 +369,7 @@ const state = reactive<LocalState>({host: isDev() ? "127.0.0.1" : "host.docker.internal",username: "",srv: false,- authSource: "",+ authenticationDatabase: "",},showCreateInstanceWarningModal: false,createInstanceWarning: "",@@ -413,7 +416,7 @@ const showDatabase = computed((): boolean => {return state.instance.engine === "POSTGRES";});-const showAuthSource = computed((): boolean => {+const showAuthenticationDatabase = computed((): boolean => {return state.instance.engine === "MONGODB";});@@ -498,8 +501,11 @@ const handleInstanceDatabaseInput = (event: Event) => {updateInstance("database", (event.target as HTMLInputElement).value);};-const handleInstanceAuthSourceInput = (event: Event) => {- updateInstance("authSource", (event.target as HTMLInputElement).value);+const handleInstanceAuthenticationDatabaseInput = (event: Event) => {+ updateInstance(+ "authenticationDatabase",+ (event.target as HTMLInputElement).value+ );};const handleToggleSRV = (on: boolean) => {@@ -516,7 +522,7 @@ const updateInstance = (field: string, value: string | boolean) => {field === "username" ||field === "password" ||field === "database" ||- field === "authSource"+ field === "authenticationDatabase") {str = (value as string).trim();}@@ -572,7 +578,7 @@ const tryCreate = () => {host: instance.host,port: instance.port,srv: instance.srv,- authSource: instance.authSource,+ authenticationDatabase: instance.authenticationDatabase,};if (showSSL.value) {@@ -657,7 +663,8 @@ const testConnection = () => {useEmptyPassword: false,instanceId: undefined,srv: instance.srv,- authSource: instance.engine === "MONGODB" ? instance.authSource : "",+ authenticationDatabase:+ instance.engine === "MONGODB" ? instance.authenticationDatabase : "",};if (showSSL.value) {diff --git a/frontend/src/components/InstanceForm.vue b/frontend/src/components/InstanceForm.vueindex d529bd2623..2908010538 100644--- a/frontend/src/components/InstanceForm.vue+++ b/frontend/src/components/InstanceForm.vue@@ -253,22 +253,22 @@/></div>- <template v-if="showAuthSource">+ <template v-if="showAuthenticationDatabase"><div class="sm:col-span-1 sm:col-start-1"><div class="flex flex-row items-center space-x-2">- <label for="authSource" class="textlabel block">- Auth Source+ <label for="authenticationDatabase" class="textlabel block">+ {{ $t("instance.authentication-database") }}</label></div><input- id="authSource"- name="authSource"+ id="authenticationDatabase"+ name="authenticationDatabase"type="text"class="textfield mt-1 w-full"autocomplete="off"- placeholder="Auth Source"- :value="currentDataSource.options.authSource"- @input="handleInstanceAuthSourceInput"+ placeholder="admin"+ :value="currentDataSource.options.authenticationDatabase"+ @input="handleInstanceAuthenticationDatabaseInput"/></div></template>@@ -583,7 +583,7 @@ const showSSL = computed((): boolean => {);});-const showAuthSource = computed((): boolean => {+const showAuthenticationDatabase = computed((): boolean => {return state.instance.engine === "MONGODB";});@@ -630,9 +630,9 @@ const handleCurrentDataSourcePasswordInput = (event: Event) => {updateInstanceDataSource(currentDataSource.value);};-const handleInstanceAuthSourceInput = (event: Event) => {+const handleInstanceAuthenticationDatabaseInput = (event: Event) => {const str = (event.target as HTMLInputElement).value.trim();- currentDataSource.value.options.authSource = str;+ currentDataSource.value.options.authenticationDatabase = str;updateInstanceDataSource(currentDataSource.value);};@@ -753,7 +753,7 @@ const handleCreateDataSource = (type: DataSourceType) => {username: "",password: "",options: {- authSource: "",+ authenticationDatabase: "",srv: false,},} as DataSource;@@ -926,7 +926,7 @@ const testConnection = () => {port: connectionPort,database: dataSource.database,srv: dataSource.options.srv,- authSource: dataSource.options.authSource,+ authenticationDatabase: dataSource.options.authenticationDatabase,};if (typeof dataSource.sslCa !== "undefined") {diff --git a/frontend/src/locales/en-US.json b/frontend/src/locales/en-US.jsonindex bed324ef85..1465e85625 100644--- a/frontend/src/locales/en-US.json+++ b/frontend/src/locales/en-US.json@@ -680,6 +680,7 @@"host-or-socket": "Host or Socket","your-snowflake-account-name": "your Snowflake account name","port": "Port",+ "authentication-database": "Authentication Database","instance-name": "Instance Name","instance-name-unique": "The instance name should be unique.","snowflake-web-console": "Snowflake Web Console",diff --git a/frontend/src/locales/zh-CN.json b/frontend/src/locales/zh-CN.jsonindex 11b6f8d924..1ced64c999 100644--- a/frontend/src/locales/zh-CN.json+++ b/frontend/src/locales/zh-CN.json@@ -739,7 +739,8 @@"failed-to-connect-instance": "连接到实例失败。","failed-to-connect-instance-localhost": "连接到实例失败。\n如果您使用的 Docker 部署,请尝试使用 \"host.docker.internal\" 作为 Host 地址。","search-instance-name": "搜索实例名称",- "grants": "权限"+ "grants": "权限",+ "authentication-database": "认证数据库"},"environment": {"select": "选择环境",diff --git a/frontend/src/types/dataSource.ts b/frontend/src/types/dataSource.tsindex 34314b7864..e40ce33c82 100644--- a/frontend/src/types/dataSource.ts+++ b/frontend/src/types/dataSource.ts@@ -16,7 +16,7 @@ export type DataSourceType = "ADMIN" | "RW" | "RO";// DataSourceOptions is the options for a data source.export type DataSourceOptions = {srv: boolean;- authSource: string;+ authenticationDatabase: string;};export type DataSource = {diff --git a/frontend/src/types/instance.ts b/frontend/src/types/instance.tsindex 6f7b6877a7..2b1c229049 100644--- a/frontend/src/types/instance.ts+++ b/frontend/src/types/instance.ts@@ -84,7 +84,7 @@ export type Instance = {engineVersion: string;externalLink?: string;srv: boolean;- authSource: string;+ authenticationDatabase: string;};export type InstanceCreate = {@@ -107,7 +107,7 @@ export type InstanceCreate = {// DNS SRV record is only used for MongoDB.srv: boolean;// For MongoDB, the auth database is used to authenticate the user.- authSource: string;+ authenticationDatabase: string;};export type InstancePatch = {diff --git a/frontend/src/types/sql.ts b/frontend/src/types/sql.tsindex 13138fdb1f..1e2f1f0519 100644--- a/frontend/src/types/sql.ts+++ b/frontend/src/types/sql.ts@@ -19,7 +19,7 @@ export type ConnectionInfo = {sslCert?: string;sslKey?: string;srv: boolean;- authSource: string;+ authenticationDatabase: string;};export type QueryInfo = {diff --git a/plugin/db/driver.go b/plugin/db/driver.goindex 978475d898..6caec97d9c 100644--- a/plugin/db/driver.go+++ b/plugin/db/driver.go@@ -459,8 +459,8 @@ type ConnectionConfig struct {StrictUseDb bool// SRV is only supported for MongoDB now.SRV bool- // AuthSource is only supported for MongoDB now.- AuthSource string+ // AuthenticationDatabase is only supported for MongoDB now.+ AuthenticationDatabase string}// ConnectionContext is the context for connection.diff --git a/plugin/db/mongodb/mongodb.go b/plugin/db/mongodb/mongodb.goindex 2c03a983df..5e5fb7f3f8 100644--- a/plugin/db/mongodb/mongodb.go+++ b/plugin/db/mongodb/mongodb.go@@ -184,11 +184,11 @@ func getMongoDBConnectionURI(connConfig db.ConnectionConfig) string {if connConfig.Database != "" {connectionURI = fmt.Sprintf("%s/%s", connectionURI, connConfig.Database)}- if connConfig.AuthSource != "" {+ if connConfig.AuthenticationDatabase != "" {if connConfig.Database == "" {connectionURI = fmt.Sprintf("%s/", connectionURI)}- connectionURI = fmt.Sprintf("%s?authSource=%s", connectionURI, connConfig.AuthSource)+ connectionURI = fmt.Sprintf("%s?authSource=%s", connectionURI, connConfig.AuthenticationDatabase)}return connectionURI}diff --git a/plugin/db/mongodb/mongodb_test.go b/plugin/db/mongodb/mongodb_test.goindex 7bccbab66c..40cc9ebfba 100644--- a/plugin/db/mongodb/mongodb_test.go+++ b/plugin/db/mongodb/mongodb_test.go@@ -44,12 +44,12 @@ func TestGetMongoDBConnectionURL(t *testing.T) {},{connConfig: db.ConnectionConfig{- Host: "cluster0.sample.mongodb.net",- Username: "bytebase",- Password: "passwd",- Database: "sampleDB",- AuthSource: "admin",- SRV: true,+ Host: "cluster0.sample.mongodb.net",+ Username: "bytebase",+ Password: "passwd",+ Database: "sampleDB",+ AuthenticationDatabase: "admin",+ SRV: true,},want: "mongodb+srv://bytebase:[email protected]/sampleDB?authSource=admin",},diff --git a/server/component/dbfactory/dbfactory.go b/server/component/dbfactory/dbfactory.goindex 413514058e..50eaaaa6e5 100644--- a/server/component/dbfactory/dbfactory.go+++ b/server/component/dbfactory/dbfactory.go@@ -63,11 +63,11 @@ func (d *DBFactory) GetAdminDatabaseDriver(ctx context.Context, instance *api.InSslCert: adminDataSource.SslCert,SslKey: adminDataSource.SslKey,},- Host: instance.Host,- Port: instance.Port,- Database: databaseName,- SRV: adminDataSource.Options.SRV,- AuthSource: adminDataSource.Options.AuthSource,+ Host: instance.Host,+ Port: instance.Port,+ Database: databaseName,+ SRV: adminDataSource.Options.SRV,+ AuthenticationDatabase: adminDataSource.Options.AuthenticationDatabase,},db.ConnectionContext{EnvironmentName: instance.Environment.Name,diff --git a/server/instance.go b/server/instance.goindex b49fa552a8..9d92a762be 100644--- a/server/instance.go+++ b/server/instance.go@@ -53,8 +53,8 @@ func (s *Server) registerInstanceRoutes(g *echo.Group) {Host: instanceCreate.Host,Port: instanceCreate.Port,Options: api.DataSourceOptions{- SRV: instanceCreate.SRV,- AuthSource: instanceCreate.AuthSource,+ SRV: instanceCreate.SRV,+ AuthenticationDatabase: instanceCreate.AuthenticationDatabase,},Database: instanceCreate.Database,},diff --git a/server/sql.go b/server/sql.goindex a9f3bd01a8..fc9f0ee13e 100644--- a/server/sql.go+++ b/server/sql.go@@ -80,14 +80,14 @@ func (s *Server) registerSQLRoutes(g *echo.Group) {connectionInfo.Engine,db.DriverConfig{},db.ConnectionConfig{- Username: connectionInfo.Username,- Password: password,- Host: connectionInfo.Host,- Port: connectionInfo.Port,- TLSConfig: tlsConfig,- SRV: connectionInfo.SRV,- AuthSource: connectionInfo.AuthSource,- Database: connectionInfo.Database,+ Username: connectionInfo.Username,+ Password: password,+ Host: connectionInfo.Host,+ Port: connectionInfo.Port,+ TLSConfig: tlsConfig,+ SRV: connectionInfo.SRV,+ AuthenticationDatabase: connectionInfo.AuthenticationDatabase,+ Database: connectionInfo.Database,},db.ConnectionContext{},)