mirror of
https://github.com/yuezk/GlobalProtect-openconnect.git
synced 2025-05-20 07:26:58 -04:00
@@ -19,6 +19,7 @@ pub struct SamlAuthLauncher<'a> {
|
||||
ignore_tls_errors: bool,
|
||||
clean: bool,
|
||||
default_browser: bool,
|
||||
external_browser: Option<&'a str>,
|
||||
}
|
||||
|
||||
impl<'a> SamlAuthLauncher<'a> {
|
||||
@@ -35,6 +36,7 @@ impl<'a> SamlAuthLauncher<'a> {
|
||||
ignore_tls_errors: false,
|
||||
clean: false,
|
||||
default_browser: false,
|
||||
external_browser: None,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -88,6 +90,11 @@ impl<'a> SamlAuthLauncher<'a> {
|
||||
self
|
||||
}
|
||||
|
||||
pub fn external_browser(mut self, external_browser: Option<&'a str>) -> Self {
|
||||
self.external_browser = external_browser;
|
||||
self
|
||||
}
|
||||
|
||||
/// Launch the authenticator binary as the current user or SUDO_USER if available.
|
||||
pub async fn launch(self) -> anyhow::Result<Option<Credential>> {
|
||||
let mut auth_cmd = Command::new(GP_AUTH_BINARY);
|
||||
@@ -133,6 +140,10 @@ impl<'a> SamlAuthLauncher<'a> {
|
||||
auth_cmd.arg("--default-browser");
|
||||
}
|
||||
|
||||
if let Some(external_browser) = self.external_browser {
|
||||
auth_cmd.arg("--external-browser").arg(external_browser);
|
||||
}
|
||||
|
||||
let mut non_root_cmd = auth_cmd.into_non_root()?;
|
||||
let output = non_root_cmd
|
||||
.kill_on_drop(true)
|
||||
|
Reference in New Issue
Block a user