mirror of
https://github.com/yuezk/GlobalProtect-openconnect.git
synced 2025-05-20 07:26:58 -04:00
fix: enhance gpauth
to support browser authentication
This commit is contained in:
@@ -1,9 +1,10 @@
|
||||
use std::collections::HashMap;
|
||||
|
||||
use anyhow::bail;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use specta::Type;
|
||||
|
||||
use crate::auth::SamlAuthData;
|
||||
use crate::auth::{SamlAuthData, SamlAuthResult};
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Type, Clone)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
@@ -230,6 +231,17 @@ impl From<SamlAuthData> for Credential {
|
||||
}
|
||||
}
|
||||
|
||||
impl TryFrom<SamlAuthResult> for Credential {
|
||||
type Error = anyhow::Error;
|
||||
|
||||
fn try_from(value: SamlAuthResult) -> anyhow::Result<Self> {
|
||||
match value {
|
||||
SamlAuthResult::Success(auth_data) => Ok(Self::from(auth_data)),
|
||||
SamlAuthResult::Failure(err) => bail!(err),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<PasswordCredential> for Credential {
|
||||
fn from(value: PasswordCredential) -> Self {
|
||||
Self::Password(value)
|
||||
|
Reference in New Issue
Block a user