fix: handle authentication cancellation in auth results

This commit is contained in:
Kevin Yue committed 2026-07-04 18:37:16 +08:00
1 parent d83bb22c58
commit 6e01164a56
5 files changed
+36 -6

No files matched your search

+2 -1
View File
@@ -1,7 +1,7 @@
use auth::{BrowserAuthenticator, auth_prelogin};
use clap::Parser;
use gpapi::{
auth::{SamlAuthData, SamlAuthResult},
auth::{AuthenticationCancelled, SamlAuthData, SamlAuthResult},
clap::{Args, InfoLevelVerbosity, args::Os, handle_error},
gp_params::GpParams,
os_profile::{ClientOs, OsProfile},
@@ -232,6 +232,7 @@ pub fn print_auth_result(auth_result: anyhow::Result<SamlAuthData>, host_id: Opt
};
SamlAuthResult::Success(auth_data)
}
Err(err) if err.downcast_ref::<AuthenticationCancelled>().is_some() => SamlAuthResult::Cancelled,
Err(err) => SamlAuthResult::Failure(format!("{}", err)),
};