feat: add auth_executable parameter to SamlAuthLauncher and update launch logic

This commit is contained in:
Kevin Yue committed 2025-11-12 23:35:44 +08:00
1 parent 603975bfe0
commit 49a7cbfe99
1 file changed
+9 -1
+9 -1
View File
@@ -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 {