mirror of
https://github.com/yuezk/GlobalProtect-openconnect.git
synced 2026-11-17 13:46:27 -05:00
feat: add auth_executable parameter to SamlAuthLauncher and update launch logic
This commit is contained in:
1 file changed
+9
-1
@@ -10,6 +10,7 @@ use super::command_traits::CommandExt;
|
||||
|
||||
pub struct SamlAuthLauncher<'a> {
|
||||
server: &'a str,
|
||||
auth_executable: Option<&'a str>,
|
||||
gateway: bool,
|
||||
saml_request: Option<&'a str>,
|
||||
user_agent: Option<&'a str>,
|
||||
@@ -31,6 +32,7 @@ impl<'a> SamlAuthLauncher<'a> {
|
||||
pub fn new(server: &'a str) -> Self {
|
||||
Self {
|
||||
server,
|
||||
auth_executable: None,
|
||||
gateway: false,
|
||||
saml_request: None,
|
||||
user_agent: None,
|
||||
@@ -49,6 +51,11 @@ impl<'a> SamlAuthLauncher<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn auth_executable(mut self, auth_executable: Option<&'a str>) -> Self {
|
||||
self.auth_executable = auth_executable;
|
||||
self
|
||||
}
|
||||
|
||||
pub fn gateway(mut self, gateway: bool) -> Self {
|
||||
self.gateway = gateway;
|
||||
self
|
||||
@@ -114,7 +121,8 @@ impl<'a> SamlAuthLauncher<'a> {
|
||||
|
||||
/// Launch the authenticator binary as the current user or SUDO_USER if available.
|
||||
pub async fn launch(self) -> anyhow::Result<Credential> {
|
||||
let mut auth_cmd = Command::new(GP_AUTH_BINARY);
|
||||
let program = self.auth_executable.unwrap_or(GP_AUTH_BINARY);
|
||||
let mut auth_cmd = Command::new(program);
|
||||
auth_cmd.arg(self.server);
|
||||
|
||||
if self.gateway {
|
||||
|
||||
Reference in new issue
Block a user