Support connect gateway (#306)

This commit is contained in:
Kevin Yue
2024-01-28 11:41:48 +08:00
committed by GitHub
parent 6fe6a1387a
commit b2bb35994f
14 changed files with 220 additions and 92 deletions

View File

@@ -8,6 +8,7 @@ use super::command_traits::CommandExt;
pub struct SamlAuthLauncher<'a> {
server: &'a str,
gateway: bool,
saml_request: Option<&'a str>,
user_agent: Option<&'a str>,
os: Option<&'a str>,
@@ -22,6 +23,7 @@ impl<'a> SamlAuthLauncher<'a> {
pub fn new(server: &'a str) -> Self {
Self {
server,
gateway: false,
saml_request: None,
user_agent: None,
os: None,
@@ -33,6 +35,11 @@ impl<'a> SamlAuthLauncher<'a> {
}
}
pub fn gateway(mut self, gateway: bool) -> Self {
self.gateway = gateway;
self
}
pub fn saml_request(mut self, saml_request: &'a str) -> Self {
self.saml_request = Some(saml_request);
self
@@ -78,6 +85,10 @@ impl<'a> SamlAuthLauncher<'a> {
let mut auth_cmd = Command::new(GP_AUTH_BINARY);
auth_cmd.arg(self.server);
if self.gateway {
auth_cmd.arg("--gateway");
}
if let Some(saml_request) = self.saml_request {
auth_cmd.arg("--saml-request").arg(saml_request);
}