mirror of
https://github.com/yuezk/GlobalProtect-openconnect.git
synced 2026-11-19 06:26:14 -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> {
|
pub struct SamlAuthLauncher<'a> {
|
||||||
server: &'a str,
|
server: &'a str,
|
||||||
|
auth_executable: Option<&'a str>,
|
||||||
gateway: bool,
|
gateway: bool,
|
||||||
saml_request: Option<&'a str>,
|
saml_request: Option<&'a str>,
|
||||||
user_agent: Option<&'a str>,
|
user_agent: Option<&'a str>,
|
||||||
@@ -31,6 +32,7 @@ impl<'a> SamlAuthLauncher<'a> {
|
|||||||
pub fn new(server: &'a str) -> Self {
|
pub fn new(server: &'a str) -> Self {
|
||||||
Self {
|
Self {
|
||||||
server,
|
server,
|
||||||
|
auth_executable: None,
|
||||||
gateway: false,
|
gateway: false,
|
||||||
saml_request: None,
|
saml_request: None,
|
||||||
user_agent: 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 {
|
pub fn gateway(mut self, gateway: bool) -> Self {
|
||||||
self.gateway = gateway;
|
self.gateway = gateway;
|
||||||
self
|
self
|
||||||
@@ -114,7 +121,8 @@ impl<'a> SamlAuthLauncher<'a> {
|
|||||||
|
|
||||||
/// Launch the authenticator binary as the current user or SUDO_USER if available.
|
/// Launch the authenticator binary as the current user or SUDO_USER if available.
|
||||||
pub async fn launch(self) -> anyhow::Result<Credential> {
|
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);
|
auth_cmd.arg(self.server);
|
||||||
|
|
||||||
if self.gateway {
|
if self.gateway {
|
||||||
|
|||||||
Reference in new issue
Block a user