feat: gpauth support Windows

This commit is contained in:
Kevin Yue
2025-02-02 18:37:18 +08:00
parent fe3d3df662
commit 3175d1083a
14 changed files with 199 additions and 21 deletions

View File

@@ -27,7 +27,7 @@ chacha20poly1305 = { version = "0.10", features = ["std"] }
redact-engine.workspace = true
url.workspace = true
regex.workspace = true
uzers.workspace = true
serde_urlencoded.workspace = true
md5.workspace = true
sha256.workspace = true
@@ -39,6 +39,9 @@ clap-verbosity-flag = { workspace = true, optional = true }
env_logger = { workspace = true, optional = true }
log-reload = { version = "0.1", optional = true }
[target.'cfg(target_family="unix")'.dependencies]
uzers.workspace = true
[features]
tauri = ["dep:tauri"]
clap = ["dep:clap", "dep:clap-verbosity-flag"]

View File

@@ -104,7 +104,7 @@ impl SamlAuthData {
}
let auth_data = decode_to_string(auth_data).map_err(|e| {
warn!("Failed to decode SAML auth data: {}", e);
warn!("Failed to decode SAML auth data: {}", auth_data);
AuthDataParseError::Invalid(anyhow::anyhow!(e))
})?;
let auth_data = Self::from_html(&auth_data)?;

View File

@@ -1,5 +1,7 @@
mod login;
mod parse_gateways;
#[cfg(unix)]
pub mod hip;
pub use login::*;

View File

@@ -4,7 +4,10 @@ pub mod error;
pub mod gateway;
pub mod gp_params;
pub mod portal;
#[cfg(unix)]
pub mod process;
pub mod service;
pub mod utils;

View File

@@ -1,8 +1,11 @@
pub(crate) mod command_traits;
pub(crate) mod gui_helper_launcher;
pub mod auth_launcher;
pub mod gui_launcher;
pub mod hip_launcher;
pub mod service_launcher;
#[cfg(unix)]
pub mod users;

View File

@@ -9,7 +9,7 @@ pub mod lock_file;
pub mod openssl;
pub mod redact;
pub mod request;
#[cfg(feature = "tauri")]
#[cfg(all(feature = "tauri", not(any(target_os = "macos", target_os = "windows"))))]
pub mod window;
mod shutdown_signal;

View File

@@ -6,15 +6,21 @@ pub async fn shutdown_signal() {
};
#[cfg(unix)]
let terminate = async {
signal::unix::signal(signal::unix::SignalKind::terminate())
.expect("failed to install signal handler")
.recv()
.await;
};
{
let terminate = async {
signal::unix::signal(signal::unix::SignalKind::terminate())
.expect("failed to install signal handler")
.recv()
.await;
};
tokio::select! {
_ = ctrl_c => {},
_ = terminate => {},
}
}
tokio::select! {
_ = ctrl_c => {},
_ = terminate => {},
#[cfg(not(unix))]
{
ctrl_c.await;
}
}