diff --git a/Cargo.lock b/Cargo.lock index f352aa4..d46c222 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1439,6 +1439,7 @@ dependencies = [ "dotenvy_macro", "log", "md5", + "open", "redact-engine", "regex", "reqwest", @@ -1470,7 +1471,6 @@ dependencies = [ "gpapi", "html-escape", "log", - "open", "regex", "serde_json", "tauri", diff --git a/Cargo.toml b/Cargo.toml index a249812..2801181 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -44,7 +44,6 @@ compile-time = "0.2" serde_urlencoded = "0.7" md5="0.7" sha256="1" -open = "5" # Tauri dependencies tauri = { version = "1.5" } diff --git a/apps/gpauth/Cargo.toml b/apps/gpauth/Cargo.toml index fa8f75f..5dd859f 100644 --- a/apps/gpauth/Cargo.toml +++ b/apps/gpauth/Cargo.toml @@ -8,7 +8,11 @@ license.workspace = true tauri-build = { version = "1.5", features = [] } [dependencies] -gpapi = { path = "../../crates/gpapi", features = ["tauri", "clap"] } +gpapi = { path = "../../crates/gpapi", features = [ + "tauri", + "clap", + "browser-auth", +] } anyhow.workspace = true clap.workspace = true env_logger.workspace = true @@ -22,4 +26,3 @@ html-escape = "0.2.13" webkit2gtk = "0.18.2" tauri = { workspace = true, features = ["http-all"] } compile-time.workspace = true -open.workspace = true diff --git a/apps/gpauth/src/cli.rs b/apps/gpauth/src/cli.rs index 1ab97f8..3d64f6c 100644 --- a/apps/gpauth/src/cli.rs +++ b/apps/gpauth/src/cli.rs @@ -3,6 +3,7 @@ use gpapi::{ auth::{SamlAuthData, SamlAuthResult}, clap::args::Os, gp_params::{ClientOs, GpParams}, + process::browser_authenticator::BrowserAuthenticator, utils::{normalize_server, openssl}, GP_USER_AGENT, }; @@ -11,10 +12,7 @@ use serde_json::json; use tauri::{App, AppHandle, RunEvent}; use tempfile::NamedTempFile; -use crate::{ - auth_window::{portal_prelogin, AuthWindow}, - browser_authenticator::BrowserAuthenticator, -}; +use crate::auth_window::{portal_prelogin, AuthWindow}; const VERSION: &str = concat!(env!("CARGO_PKG_VERSION"), " (", compile_time::date_str!(), ")"); diff --git a/apps/gpauth/src/main.rs b/apps/gpauth/src/main.rs index 2c8ba0b..74f86ec 100644 --- a/apps/gpauth/src/main.rs +++ b/apps/gpauth/src/main.rs @@ -1,7 +1,6 @@ #![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] mod auth_window; -mod browser_authenticator; mod cli; #[tokio::main] diff --git a/crates/gpapi/Cargo.toml b/crates/gpapi/Cargo.toml index 67075bf..af91e7e 100644 --- a/crates/gpapi/Cargo.toml +++ b/crates/gpapi/Cargo.toml @@ -31,7 +31,9 @@ sha256.workspace = true tauri = { workspace = true, optional = true } clap = { workspace = true, optional = true } +open = { version = "5", optional = true } [features] tauri = ["dep:tauri"] clap = ["dep:clap"] +browser-auth = ["dep:open"] diff --git a/apps/gpauth/src/browser_authenticator.rs b/crates/gpapi/src/process/browser_authenticator.rs similarity index 100% rename from apps/gpauth/src/browser_authenticator.rs rename to crates/gpapi/src/process/browser_authenticator.rs diff --git a/crates/gpapi/src/process/mod.rs b/crates/gpapi/src/process/mod.rs index b5beb20..5dbb18c 100644 --- a/crates/gpapi/src/process/mod.rs +++ b/crates/gpapi/src/process/mod.rs @@ -2,6 +2,8 @@ pub(crate) mod command_traits; pub(crate) mod gui_helper_launcher; pub mod auth_launcher; +#[cfg(feature = "browser-auth")] +pub mod browser_authenticator; pub mod gui_launcher; pub mod hip_launcher; pub mod service_launcher;