From c83dfa8b246f10310c720d52d70f9f67866e828a Mon Sep 17 00:00:00 2001 From: Kevin Yue Date: Mon, 9 Feb 2026 22:37:39 +0800 Subject: [PATCH] fix: trim leading slash from auth callback data --- crates/gpapi/src/auth.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/crates/gpapi/src/auth.rs b/crates/gpapi/src/auth.rs index cfda692..ebd7dd7 100644 --- a/crates/gpapi/src/auth.rs +++ b/crates/gpapi/src/auth.rs @@ -84,6 +84,8 @@ impl SamlAuthData { pub fn from_gpcallback(data: &str) -> anyhow::Result { let auth_data = data.trim_start_matches("globalprotectcallback:"); + // Further remove the leading "/" if it exists, because some versions of GP may include it + let auth_data = auth_data.trim_start_matches('/'); if auth_data.starts_with("cas-as") { info!("Got CAS auth data from globalprotectcallback"); @@ -104,7 +106,7 @@ impl SamlAuthData { } let auth_data = decode_to_string(auth_data).map_err(|e| { - warn!("Failed to decode SAML auth data: {}, data: {}", e, auth_data); + warn!("Failed to decode SAML auth data: {}, data: {}", e, data); AuthDataParseError::Invalid(anyhow::anyhow!(e)) })?; let auth_data = Self::from_html(&auth_data)?;