From 9244f15e0c8622d07023bd16b2d85115f76c1be0 Mon Sep 17 00:00:00 2001 From: keypair34 <216233964+keypair34@users.noreply.github.com> Date: Wed, 30 Sep 2026 10:27:51 +0200 Subject: [PATCH 1/2] Add Apple OAuth settings to AuthApp responses Deserialize optional Apple configuration fields without breaking older API responses. Keep the provider secret out of the response model. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- crates/smbcloud-model/src/app_auth.rs | 33 +++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/crates/smbcloud-model/src/app_auth.rs b/crates/smbcloud-model/src/app_auth.rs index 77fcde9..4bbef6b 100644 --- a/crates/smbcloud-model/src/app_auth.rs +++ b/crates/smbcloud-model/src/app_auth.rs @@ -13,6 +13,10 @@ pub struct AuthApp { // arg — the two are intentionally different types. pub project_id: Option, pub support_email: Option, + pub apple_oauth_enabled: Option, + pub apple_oauth_client_id: Option, + pub apple_oauth_configured: Option, + pub apple_oauth_secret_present: Option, #[serde(with = "ar_date_format")] pub created_at: DateTime, #[serde(with = "ar_date_format")] @@ -77,6 +81,35 @@ pub struct AuthAppClientCreate { mod tests { use super::*; use serde_json::json; + + #[test] + fn auth_app_apple_settings_are_optional_and_typed() -> Result<(), serde_json::Error> { + let mut payload = json!({ + "id": "app-id", + "name": "Example", + "created_at": "2026-09-30T08:00:00.000Z", + "updated_at": "2026-09-30T08:00:00.000Z" + }); + let legacy: AuthApp = serde_json::from_value(payload.clone())?; + assert_eq!(legacy.apple_oauth_enabled, None); + assert_eq!(legacy.apple_oauth_client_id, None); + assert_eq!(legacy.apple_oauth_configured, None); + assert_eq!(legacy.apple_oauth_secret_present, None); + + payload["apple_oauth_enabled"] = json!(true); + payload["apple_oauth_client_id"] = json!("com.example.web"); + payload["apple_oauth_configured"] = json!(true); + payload["apple_oauth_secret_present"] = json!(true); + let configured: AuthApp = serde_json::from_value(payload)?; + assert_eq!(configured.apple_oauth_enabled, Some(true)); + assert_eq!( + configured.apple_oauth_client_id.as_deref(), + Some("com.example.web") + ); + assert_eq!(configured.apple_oauth_configured, Some(true)); + assert_eq!(configured.apple_oauth_secret_present, Some(true)); + Ok(()) + } #[test] fn test_auth_app_create() { let auth_app_create = AuthAppCreate { From 99c765d50b347c0b4c3a0e63a93f2ae8fd9aebb4 Mon Sep 17 00:00:00 2001 From: keypair34 <216233964+keypair34@users.noreply.github.com> Date: Wed, 30 Sep 2026 19:41:04 +0200 Subject: [PATCH 2/2] Document and test Apple OAuth response fields Co-Authored-By: siGit Code --- crates/smbcloud-model/src/app_auth.rs | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/crates/smbcloud-model/src/app_auth.rs b/crates/smbcloud-model/src/app_auth.rs index 4bbef6b..5faaf52 100644 --- a/crates/smbcloud-model/src/app_auth.rs +++ b/crates/smbcloud-model/src/app_auth.rs @@ -13,9 +13,13 @@ pub struct AuthApp { // arg — the two are intentionally different types. pub project_id: Option, pub support_email: Option, + /// Whether Sign in with Apple is enabled for this auth app. pub apple_oauth_enabled: Option, + /// The Services ID used as the Apple OAuth client identifier. pub apple_oauth_client_id: Option, + /// Whether the required Apple OAuth credentials are configured. pub apple_oauth_configured: Option, + /// Whether an Apple OAuth client secret has been stored. pub apple_oauth_secret_present: Option, #[serde(with = "ar_date_format")] pub created_at: DateTime, @@ -87,8 +91,8 @@ mod tests { let mut payload = json!({ "id": "app-id", "name": "Example", - "created_at": "2026-09-30T08:00:00.000Z", - "updated_at": "2026-09-30T08:00:00.000Z" + "created_at": "2026-09-30T08:00:00.000+00:00", + "updated_at": "2026-09-30T08:00:00.000+00:00" }); let legacy: AuthApp = serde_json::from_value(payload.clone())?; assert_eq!(legacy.apple_oauth_enabled, None); @@ -108,6 +112,15 @@ mod tests { ); assert_eq!(configured.apple_oauth_configured, Some(true)); assert_eq!(configured.apple_oauth_secret_present, Some(true)); + + let serialized = serde_json::to_value(&configured)?; + assert_eq!(serialized["apple_oauth_enabled"], json!(true)); + assert_eq!( + serialized["apple_oauth_client_id"], + json!("com.example.web") + ); + assert_eq!(serialized["apple_oauth_configured"], json!(true)); + assert_eq!(serialized["apple_oauth_secret_present"], json!(true)); Ok(()) } #[test]