fix: handle authentication cancellation in auth results

This commit is contained in:
Kevin Yue committed 2026-07-04 18:37:16 +08:00
1 parent d83bb22c58
commit 6e01164a56
5 files changed
+36 -6

No files matched your search

+2 -1
View File
@@ -2,7 +2,7 @@ use anyhow::bail;
use serde::{Deserialize, Serialize};
use specta::Type;
use crate::auth::{SamlAuthData, SamlAuthResult};
use crate::auth::{AuthenticationCancelled, SamlAuthData, SamlAuthResult};
#[derive(Debug, Serialize, Deserialize, Type, Clone)]
#[serde(rename_all = "camelCase")]
@@ -250,6 +250,7 @@ impl TryFrom<SamlAuthResult> for Credential {
fn try_from(value: SamlAuthResult) -> anyhow::Result<Self> {
match value {
SamlAuthResult::Success(auth_data) => Ok(Self::from(auth_data)),
SamlAuthResult::Cancelled => bail!(AuthenticationCancelled),
SamlAuthResult::Failure(err) => bail!(err),
}
}