Files
GlobalProtect-openconnect/crates/auth/src/lib.rs
T
Kevin Yue 888dc93643 refactor: align GP profile and packaging flow
Main changes:

- Refactor connect/auth flows around a single OS profile and host identity model, including gateway fallback and cookie-on-stdin handling.

- Align request parameters, HIP host-id propagation, SAML webview user-agent behavior, and portal default-browser handling with observed official client behavior.

- Add opt-in cookie cache support and Microsoft Defender HIP reporting while keeping host-id validation explicit.

- Add BSD build, packaging, release artifact, and provenance support with FreeBSD/OpenBSD path and dependency cleanup.

- Update NixOS install documentation and dependency compatibility fixes.
2026-06-19 21:23:29 +08:00

31 lines
903 B
Rust

use anyhow::bail;
use gpapi::{
gp_params::GpParams,
portal::{Prelogin, PreloginOptions, prelogin},
};
#[cfg(feature = "browser-auth")]
mod browser;
#[cfg(feature = "browser-auth")]
pub use browser::*;
#[cfg(feature = "webview-auth")]
mod webview;
#[cfg(feature = "webview-auth")]
pub use webview::*;
pub async fn auth_prelogin(
server: &str,
gp_params: &GpParams,
external_browser_requested: bool,
) -> anyhow::Result<String> {
// gpauth only performs the initial portal/gateway prelogin. Portal policy is
// not available here, so gateway prelogin stays on the embedded value.
let options = PreloginOptions::default().external_browser_requested(external_browser_requested);
match prelogin(server, gp_params, options).await? {
Prelogin::Saml(prelogin) => Ok(prelogin.saml_request().to_string()),
Prelogin::Standard(_) => bail!("Received non-SAML prelogin response"),
}
}