From 1611bb652a2e1c27be0721f96e832aedc35d2bce Mon Sep 17 00:00:00 2001 From: Adis Veletanlic Date: Mon, 14 Apr 2025 13:41:43 +0200 Subject: [PATCH] Format project and run misc/update.sh --- crates/config/src/sections/upstream_oauth2.rs | 6 +- .../handlers/src/upstream_oauth2/callback.rs | 3 +- crates/handlers/src/upstream_oauth2/mod.rs | 5 +- docs/config.schema.json | 64 ++++++------------- 4 files changed, 29 insertions(+), 49 deletions(-) diff --git a/crates/config/src/sections/upstream_oauth2.rs b/crates/config/src/sections/upstream_oauth2.rs index 086291840..623a97c14 100644 --- a/crates/config/src/sections/upstream_oauth2.rs +++ b/crates/config/src/sections/upstream_oauth2.rs @@ -6,11 +6,11 @@ use std::collections::BTreeMap; +use camino::Utf8PathBuf; use mas_iana::jose::JsonWebSignatureAlg; use schemars::JsonSchema; use serde::{Deserialize, Serialize, de::Error}; use serde_with::skip_serializing_none; -use camino::Utf8PathBuf; use ulid::Ulid; use url::Url; @@ -390,7 +390,7 @@ pub struct SignInWithApple { pub private_key_file: Option, /// The private key used to sign the `id_token` - #[serde(skip_serializing_if = "Option::is_none")] + #[serde(skip_serializing_if = "Option::is_none")] pub private_key: Option, /// The Team ID of the Apple Developer Portal @@ -565,4 +565,4 @@ pub struct Provider { /// Specify `oidc` here. #[serde(skip_serializing_if = "Option::is_none")] pub synapse_idp_id: Option, -} \ No newline at end of file +} diff --git a/crates/handlers/src/upstream_oauth2/callback.rs b/crates/handlers/src/upstream_oauth2/callback.rs index 845ae1b3c..83e0cdcef 100644 --- a/crates/handlers/src/upstream_oauth2/callback.rs +++ b/crates/handlers/src/upstream_oauth2/callback.rs @@ -294,7 +294,8 @@ pub(crate) async fn handler( lazy_metadata.token_endpoint().await?, &keystore, &encrypter, - ).await?; + ) + .await?; let redirect_uri = url_builder.upstream_oauth_callback(provider.id); diff --git a/crates/handlers/src/upstream_oauth2/mod.rs b/crates/handlers/src/upstream_oauth2/mod.rs index 0f56bfd98..695c50efb 100644 --- a/crates/handlers/src/upstream_oauth2/mod.rs +++ b/crates/handlers/src/upstream_oauth2/mod.rs @@ -6,13 +6,13 @@ use std::string::FromUtf8Error; +use camino::Utf8PathBuf; use mas_data_model::{UpstreamOAuthProvider, UpstreamOAuthProviderTokenAuthMethod}; use mas_iana::jose::JsonWebSignatureAlg; use mas_keystore::{DecryptError, Encrypter, Keystore}; use mas_oidc_client::types::client_credentials::ClientCredentials; use pkcs8::DecodePrivateKey; use schemars::JsonSchema; -use camino::Utf8PathBuf; use serde::Deserialize; use thiserror::Error; use url::Url; @@ -142,7 +142,8 @@ async fn client_credentials_for_provider( }, UpstreamOAuthProviderTokenAuthMethod::SignInWithApple => { - let client_secret = client_secret.ok_or(ProviderCredentialsError::MissingClientSecret)?; + let client_secret = + client_secret.ok_or(ProviderCredentialsError::MissingClientSecret)?; let params: SignInWithApple = serde_json::from_str(&client_secret) .map_err(|inner| ProviderCredentialsError::InvalidClientSecretJson { inner })?; diff --git a/docs/config.schema.json b/docs/config.schema.json index bd69b42bd..165cf947d 100644 --- a/docs/config.schema.json +++ b/docs/config.schema.json @@ -2156,50 +2156,28 @@ }, "SignInWithApple": { "type": "object", - "oneOf": [ - { - "required": [ - "key_id", - "private_key_file", - "team_id" - ], - "properties": { - "private_key_file": { - "description": "The private key file used to sign the `id_token`", - "type": "string" - }, - "team_id": { - "description": "The Team ID of the Apple Developer Portal", - "type": "string" - }, - "key_id": { - "description": "The key ID of the Apple Developer Portal", - "type": "string" - } - } + "required": [ + "key_id", + "team_id" + ], + "properties": { + "private_key_file": { + "description": "The private key file used to sign the `id_token`", + "type": "string" }, - { - "required": [ - "key_id", - "private_key", - "team_id" - ], - "properties": { - "private_key": { - "description": "The private key used to sign the `id_token`", - "type": "string" - }, - "team_id": { - "description": "The Team ID of the Apple Developer Portal", - "type": "string" - }, - "key_id": { - "description": "The key ID of the Apple Developer Portal", - "type": "string" - } - } + "private_key": { + "description": "The private key used to sign the `id_token`", + "type": "string" + }, + "team_id": { + "description": "The Team ID of the Apple Developer Portal", + "type": "string" + }, + "key_id": { + "description": "The key ID of the Apple Developer Portal", + "type": "string" } - ] + } }, "DiscoveryMode": { "description": "How to discover the provider's configuration", @@ -2596,4 +2574,4 @@ } } } -} +} \ No newline at end of file