mirror of
https://github.com/yuezk/GlobalProtect-openconnect.git
synced 2025-05-20 07:26:58 -04:00
feat: gpauth support macos
This commit is contained in:
@@ -1,23 +1,28 @@
|
||||
use auth::{Authenticator, WebviewAuthenticator};
|
||||
use auth::WebviewAuthenticator;
|
||||
use gpapi::gp_params::GpParams;
|
||||
use log::info;
|
||||
use tauri::RunEvent;
|
||||
use tempfile::NamedTempFile;
|
||||
|
||||
use crate::cli::{print_auth_result, Cli};
|
||||
use crate::cli::print_auth_result;
|
||||
|
||||
pub fn authenticate(
|
||||
cli: &Cli,
|
||||
authenticator: Authenticator<'static>,
|
||||
pub async fn authenticate(
|
||||
server: String,
|
||||
gp_params: GpParams,
|
||||
auth_request: String,
|
||||
clean: bool,
|
||||
mut openssl_conf: Option<NamedTempFile>,
|
||||
) -> anyhow::Result<()> {
|
||||
let authenticator = authenticator.with_clean(cli.clean);
|
||||
|
||||
tauri::Builder::default()
|
||||
.setup(move |app| {
|
||||
let app_handle = app.handle().clone();
|
||||
|
||||
tauri::async_runtime::spawn(async move {
|
||||
let auth_result = authenticator.webview_authenticate(&app_handle).await;
|
||||
let authenticator = WebviewAuthenticator::new(&server, &gp_params)
|
||||
.with_auth_request(&auth_request)
|
||||
.with_clean(clean);
|
||||
|
||||
let auth_result = authenticator.authenticate(&app_handle).await;
|
||||
print_auth_result(auth_result);
|
||||
|
||||
// Ensure the app exits after the authentication process
|
||||
|
Reference in New Issue
Block a user