feat(oracle): add SYSDBA authentication support
Switch oracle-rs to t8y2/oracle-rs fork with SYSDBA support. Add sysdba field to ConnectionConfig and a checkbox in the Oracle connection dialog to enable connecting as SYS with SYSDBA privileges.
This commit is contained in:
parent
746a4c491a
commit
e315c4ad36
|
|
@ -1553,7 +1553,7 @@ dependencies = [
|
|||
"futures",
|
||||
"log",
|
||||
"mongodb",
|
||||
"oracle-rs",
|
||||
"oracle-rs 0.1.7",
|
||||
"percent-encoding",
|
||||
"portpicker",
|
||||
"redis",
|
||||
|
|
@ -1590,7 +1590,7 @@ dependencies = [
|
|||
"futures",
|
||||
"log",
|
||||
"mongodb",
|
||||
"oracle-rs",
|
||||
"oracle-rs 0.1.6",
|
||||
"percent-encoding",
|
||||
"portpicker",
|
||||
"redis",
|
||||
|
|
@ -4510,6 +4510,38 @@ version = "0.2.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d"
|
||||
|
||||
[[package]]
|
||||
name = "oracle-rs"
|
||||
version = "0.1.6"
|
||||
source = "git+https://github.com/t8y2/oracle-rs?branch=main#97d99d43e3d1323f7d544db8e0fdaaa0ba95cd24"
|
||||
dependencies = [
|
||||
"aes 0.8.4",
|
||||
"async-trait",
|
||||
"bytes",
|
||||
"cbc 0.1.2",
|
||||
"chrono",
|
||||
"hex",
|
||||
"hmac 0.12.1",
|
||||
"hostname",
|
||||
"indexmap 2.14.0",
|
||||
"md-5",
|
||||
"pbkdf2 0.12.2",
|
||||
"pkcs8 0.10.2",
|
||||
"rand 0.8.6",
|
||||
"rustls 0.23.40",
|
||||
"rustls-pemfile 2.2.0",
|
||||
"rustls-pki-types",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"sha1 0.10.6",
|
||||
"sha2 0.10.9",
|
||||
"thiserror 1.0.69",
|
||||
"tokio",
|
||||
"tokio-rustls 0.26.4",
|
||||
"tracing",
|
||||
"webpki-roots 0.26.11",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "oracle-rs"
|
||||
version = "0.1.7"
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ tiberius = { version = "0.12.3", default-features = false, features = ["tds73",
|
|||
reqwest = { version = "0.12", default-features = false, features = ["json", "stream", "rustls-tls"] }
|
||||
futures = "0.3"
|
||||
mongodb = "3.2.5"
|
||||
oracle-rs = "0.1"
|
||||
oracle-rs = { git = "https://github.com/t8y2/oracle-rs", branch = "main" }
|
||||
russh = "0.60"
|
||||
portpicker = "0.1.1"
|
||||
csv = "1"
|
||||
|
|
|
|||
|
|
@ -138,6 +138,7 @@ impl AppState {
|
|||
db_config.database.as_deref().unwrap_or("ORCL"),
|
||||
&db_config.username,
|
||||
&db_config.password,
|
||||
db_config.sysdba,
|
||||
)
|
||||
.await?;
|
||||
PoolKind::Oracle(Arc::new(tokio::sync::Mutex::new(client)))
|
||||
|
|
|
|||
|
|
@ -6,8 +6,16 @@ use crate::types::{ColumnInfo, DatabaseInfo, ForeignKeyInfo, IndexInfo, QueryRes
|
|||
|
||||
pub type OracleClient = Connection;
|
||||
|
||||
pub async fn connect(host: &str, port: u16, service: &str, user: &str, pass: &str) -> Result<OracleClient, String> {
|
||||
let config = Config::new(host, port, service, user, pass);
|
||||
pub async fn connect(
|
||||
host: &str,
|
||||
port: u16,
|
||||
service: &str,
|
||||
user: &str,
|
||||
pass: &str,
|
||||
sysdba: bool,
|
||||
) -> Result<OracleClient, String> {
|
||||
let mut config = Config::new(host, port, service, user, pass);
|
||||
config.sysdba = sysdba;
|
||||
tokio::time::timeout(connection_timeout(), Connection::connect_with_config(config))
|
||||
.await
|
||||
.map_err(|_| format!("Oracle connection timed out ({CONNECTION_TIMEOUT_SECS}s)"))?
|
||||
|
|
|
|||
|
|
@ -38,6 +38,8 @@ pub struct ConnectionConfig {
|
|||
#[serde(default)]
|
||||
pub ssl: bool,
|
||||
#[serde(default)]
|
||||
pub sysdba: bool,
|
||||
#[serde(default)]
|
||||
pub connection_string: Option<String>,
|
||||
}
|
||||
|
||||
|
|
@ -277,6 +279,7 @@ mod tests {
|
|||
ssh_key_passphrase: String::new(),
|
||||
ssh_expose_lan: false,
|
||||
ssl: false,
|
||||
sysdba: false,
|
||||
connection_string: None,
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -103,6 +103,7 @@ pub async fn test_connection(state: State<'_, Arc<AppState>>, config: Connection
|
|||
config.database.as_deref().unwrap_or("ORCL"),
|
||||
&config.username,
|
||||
&config.password,
|
||||
config.sysdba,
|
||||
)
|
||||
.await
|
||||
.map(|_| "Connection successful".to_string()),
|
||||
|
|
@ -168,6 +169,7 @@ pub async fn connect_db(state: State<'_, Arc<AppState>>, config: ConnectionConfi
|
|||
config.database.as_deref().unwrap_or("ORCL"),
|
||||
&config.username,
|
||||
&config.password,
|
||||
config.sysdba,
|
||||
)
|
||||
.await?;
|
||||
PoolKind::Oracle(std::sync::Arc::new(tokio::sync::Mutex::new(client)))
|
||||
|
|
|
|||
|
|
@ -794,6 +794,14 @@ async function browseSshKeyPath() {
|
|||
</p>
|
||||
</div>
|
||||
|
||||
<div v-if="form.db_type === 'oracle'" class="grid grid-cols-4 items-center gap-4">
|
||||
<Label class="text-right text-xs">SYSDBA</Label>
|
||||
<label class="col-span-3 flex items-center gap-2 cursor-pointer">
|
||||
<input type="checkbox" v-model="form.sysdba" class="mr-0" />
|
||||
<span class="text-xs text-muted-foreground">as SYSDBA</span>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div
|
||||
v-if="form.db_type === 'mysql' || form.db_type === 'postgres'"
|
||||
class="grid grid-cols-4 items-center gap-4"
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@ export interface ConnectionConfig {
|
|||
ssh_key_passphrase?: string;
|
||||
ssh_expose_lan?: boolean;
|
||||
ssl?: boolean;
|
||||
sysdba?: boolean;
|
||||
connection_string?: string;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue