diff --git a/Cargo.lock b/Cargo.lock index 5d26dae9f6..0ae7b8577d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2021,6 +2021,7 @@ dependencies = [ "tauri-plugin-dialog", "tauri-plugin-fs", "tauri-plugin-log", + "tauri-plugin-opener", "tauri-plugin-process", "tauri-plugin-shell", "tauri-plugin-single-instance", @@ -8655,6 +8656,28 @@ dependencies = [ "time", ] +[[package]] +name = "tauri-plugin-opener" +version = "2.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "17e1bea14edce6b793a04e2417e3fd924b9bc4faae83cdee7d714156cceeed29" +dependencies = [ + "dunce", + "glob", + "objc2-app-kit", + "objc2-foundation", + "open", + "schemars 0.8.22", + "serde", + "serde_json", + "tauri", + "tauri-plugin", + "thiserror 2.0.19", + "url", + "windows 0.61.3", + "zbus", +] + [[package]] name = "tauri-plugin-process" version = "2.3.1" diff --git a/apps/desktop/src/components/connection/ConnectionDialog.vue b/apps/desktop/src/components/connection/ConnectionDialog.vue index 6a12297eb6..ffbfab8e26 100644 --- a/apps/desktop/src/components/connection/ConnectionDialog.vue +++ b/apps/desktop/src/components/connection/ConnectionDialog.vue @@ -44,7 +44,7 @@ import { firstZooKeeperEndpoint, normalizeZooKeeperConnectString } from "@/lib/z import { setZooKeeperAuthScheme, zooKeeperAuthScheme as resolveZooKeeperAuthScheme, type ZooKeeperAuthScheme } from "@/lib/zookeeper/zookeeperConnectionOptions"; import { isLocalFileTypeDb } from "@/lib/connection/connectionFile"; import { MQ_PINNED_VERSION_OPTIONS, pinnedVersionToSelection, selectionToPinnedVersion } from "@/lib/mq/mqPinnedVersionOptions"; -import { mongodbAuthFailureHint, mongoUrlParam, mongoUrlParamIsTrue, normalizeMongoTlsFormState, setMongoUrlParam, setMongoUrlParamBoolean } from "@/lib/mongo/mongoConnectionOptions"; +import { mongodbAuthFailureHint, mongoConnectionUsesOidc, mongoUrlParam, mongoUrlParamIsTrue, normalizeMongoTlsFormState, setMongoUrlParam, setMongoUrlParamBoolean } from "@/lib/mongo/mongoConnectionOptions"; import { isMongoLegacyDriverProfile } from "@/lib/mongo/mongoCapabilities"; import { mysqlCleartextPasswordAuthEnabled, setMysqlCleartextPasswordAuthEnabled } from "@/lib/database/mysqlConnectionOptions"; import { applyDamengSslUrlParams, damengSslFormConfig } from "@/lib/database/damengSslOptions"; @@ -3629,9 +3629,19 @@ const mongoAuthDatabase = computed({ const mongoAuthMechanism = computed({ get: () => mongoUrlParam(form.value.url_params, "authMechanism") || "default", set: (value: string) => { - form.value.url_params = setMongoUrlParam(form.value.url_params, "authMechanism", value === "default" ? "" : value); + const previous = mongoUrlParam(form.value.url_params, "authMechanism"); + let next = setMongoUrlParam(form.value.url_params, "authMechanism", value === "default" ? "" : value); + if (value === "MONGODB-OIDC") { + form.value.password = ""; + mongoDriverMode.value = "auto"; + next = setMongoUrlParam(next, "authSource", "$external"); + } else if (previous === "MONGODB-OIDC" && mongoUrlParam(next, "authSource") === "$external") { + next = setMongoUrlParam(next, "authSource", ""); + } + form.value.url_params = next; }, }); +const mongoUsesOidc = computed(() => mongoConnectionUsesOidc(mongoUseUrl.value ? undefined : form.value.url_params, mongoUseUrl.value ? form.value.connection_string : undefined)); const mongoTlsAllowInvalidCertificates = computed({ get: () => mongoUrlParamIsTrue(form.value.url_params, "tlsAllowInvalidCertificates"), set: (value: boolean) => { @@ -4128,7 +4138,12 @@ function connectionConfigForSubmit(id: string, generatedName = ""): ConnectionCo config.connection_string = normalizeMongoConnectionString(config.connection_string?.trim() || ""); } if (config.db_type === "mongodb") { - if (isMongoLegacyDriverProfile(config.driver_profile)) { + const usesOidc = mongoConnectionUsesOidc(mongoUseUrl.value ? undefined : config.url_params, mongoUseUrl.value ? config.connection_string : undefined); + if (usesOidc) { + config.password = ""; + config.driver_profile = "mongodb"; + config.driver_label = "MongoDB"; + } else if (isMongoLegacyDriverProfile(config.driver_profile)) { config.driver_profile = "mongodb-legacy"; config.driver_label = "MongoDB (Legacy)"; } else { @@ -6841,7 +6856,7 @@ function openExternalUrl(url: string) {
- + @@ -6867,6 +6882,9 @@ function openExternalUrl(url: string) { class="col-span-3 flex min-h-[80px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring" placeholder="mongodb+srv://user:pass@cluster.mongodb.net/mydb" /> +

+ {{ t("connection.oidcBrowserAuthHint") }} +