mirror of
https://github.com/yuezk/GlobalProtect-openconnect.git
synced 2025-05-20 07:26:58 -04:00
Support connect gateway (#306)
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
Reference in New Issue
Block a user