diff --git a/bindings/matrix-sdk-ffi/src/authentication.rs b/bindings/matrix-sdk-ffi/src/authentication.rs index 82442944b..307f0469e 100644 --- a/bindings/matrix-sdk-ffi/src/authentication.rs +++ b/bindings/matrix-sdk-ffi/src/authentication.rs @@ -8,7 +8,7 @@ use std::{ use matrix_sdk::{ authentication::oauth::{ error::OAuthAuthorizationCodeError, - registration::{ApplicationType, ClientMetadata, Localized, OauthGrantType}, + registration::{ApplicationType, ClientMetadata, Localized, OAuthGrantType}, registrations::{ClientId, OidcRegistrations, OidcRegistrationsError}, OAuthError as SdkOAuthError, }, @@ -156,8 +156,8 @@ impl OidcConfiguration { ..ClientMetadata::new( ApplicationType::Native, vec![ - OauthGrantType::AuthorizationCode { redirect_uris: vec![redirect_uri] }, - OauthGrantType::DeviceCode, + OAuthGrantType::AuthorizationCode { redirect_uris: vec![redirect_uri] }, + OAuthGrantType::DeviceCode, ], client_uri, ) diff --git a/crates/matrix-sdk/src/authentication/oauth/registration.rs b/crates/matrix-sdk/src/authentication/oauth/registration.rs index 268e2c306..e9b9ed191 100644 --- a/crates/matrix-sdk/src/authentication/oauth/registration.rs +++ b/crates/matrix-sdk/src/authentication/oauth/registration.rs @@ -111,7 +111,7 @@ pub struct ClientMetadata { /// The grant types that the client will use at the token endpoint. /// /// This should match the login methods that the client can use. - pub grant_types: Vec, + pub grant_types: Vec, /// URL of the home page of the client. pub client_uri: Localized, @@ -135,7 +135,7 @@ impl ClientMetadata { /// Construct a `ClientMetadata` with only the required fields. pub fn new( application_type: ApplicationType, - grant_types: Vec, + grant_types: Vec, client_uri: Localized, ) -> Self { Self { @@ -157,7 +157,7 @@ impl ClientMetadata { /// [`OAuth`]: super::OAuth #[derive(Debug, Clone)] #[non_exhaustive] -pub enum OauthGrantType { +pub enum OAuthGrantType { /// The authorization code grant type, defined in [RFC 6749]. /// /// This grant type is necessary to use the [`OAuth::login()`] and @@ -270,12 +270,12 @@ impl From for ClientMetadataSerializeHelper { for oauth_grant_type in oauth_grant_types { match oauth_grant_type { - OauthGrantType::AuthorizationCode { redirect_uris: uris } => { + OAuthGrantType::AuthorizationCode { redirect_uris: uris } => { redirect_uris = Some(uris); response_types = Some(vec![ResponseType::Code]); grant_types.insert(GrantType::AuthorizationCode); } - OauthGrantType::DeviceCode => { + OAuthGrantType::DeviceCode => { grant_types.insert(GrantType::DeviceCode); } } @@ -360,13 +360,13 @@ mod tests { use serde_json::json; use url::Url; - use super::{ApplicationType, ClientMetadata, Localized, OauthGrantType}; + use super::{ApplicationType, ClientMetadata, Localized, OAuthGrantType}; #[test] fn test_serialize_minimal_client_metadata() { let metadata = ClientMetadata::new( ApplicationType::Native, - vec![OauthGrantType::AuthorizationCode { + vec![OAuthGrantType::AuthorizationCode { redirect_uris: vec![Url::parse("http://127.0.0.1/").unwrap()], }], Localized::new( @@ -396,13 +396,13 @@ mod tests { let mut metadata = ClientMetadata::new( ApplicationType::Web, vec![ - OauthGrantType::AuthorizationCode { + OAuthGrantType::AuthorizationCode { redirect_uris: vec![ Url::parse("http://127.0.0.1/").unwrap(), Url::parse("http://[::1]/").unwrap(), ], }, - OauthGrantType::DeviceCode, + OAuthGrantType::DeviceCode, ], Localized::new( Url::parse("https://example.org/matrix-client").unwrap(), diff --git a/crates/matrix-sdk/src/authentication/oauth/registrations.rs b/crates/matrix-sdk/src/authentication/oauth/registrations.rs index 4fbc78850..c4ef37367 100644 --- a/crates/matrix-sdk/src/authentication/oauth/registrations.rs +++ b/crates/matrix-sdk/src/authentication/oauth/registrations.rs @@ -166,7 +166,7 @@ mod tests { use tempfile::tempdir; use super::*; - use crate::authentication::oauth::registration::{ApplicationType, Localized, OauthGrantType}; + use crate::authentication::oauth::registration::{ApplicationType, Localized, OAuthGrantType}; #[test] fn test_oidc_registrations() { @@ -245,7 +245,7 @@ mod tests { let mut metadata = ClientMetadata::new( ApplicationType::Web, - vec![OauthGrantType::AuthorizationCode { redirect_uris: vec![callback_url] }], + vec![OAuthGrantType::AuthorizationCode { redirect_uris: vec![callback_url] }], Localized::new(client_uri, None), ); metadata.client_name = Some(Localized::new(client_name, None)); diff --git a/crates/matrix-sdk/src/test_utils/client.rs b/crates/matrix-sdk/src/test_utils/client.rs index 7e09730fd..ab457aa7f 100644 --- a/crates/matrix-sdk/src/test_utils/client.rs +++ b/crates/matrix-sdk/src/test_utils/client.rs @@ -179,7 +179,7 @@ pub mod oauth { use crate::{ authentication::oauth::{ - registration::{ApplicationType, ClientMetadata, Localized, OauthGrantType}, + registration::{ApplicationType, ClientMetadata, Localized, OAuthGrantType}, registrations::ClientId, OAuthSession, UserSession, }, @@ -205,8 +205,8 @@ pub mod oauth { let mut metadata = ClientMetadata::new( ApplicationType::Native, vec![ - OauthGrantType::AuthorizationCode { redirect_uris: vec![mock_redirect_uri()] }, - OauthGrantType::DeviceCode, + OAuthGrantType::AuthorizationCode { redirect_uris: vec![mock_redirect_uri()] }, + OAuthGrantType::DeviceCode, ], Localized::new(client_uri, None), ); diff --git a/examples/oidc_cli/src/main.rs b/examples/oidc_cli/src/main.rs index 7e97260e9..cecd12ca5 100644 --- a/examples/oidc_cli/src/main.rs +++ b/examples/oidc_cli/src/main.rs @@ -23,7 +23,7 @@ use anyhow::{anyhow, bail}; use futures_util::StreamExt; use matrix_sdk::{ authentication::oauth::{ - registration::{ApplicationType, ClientMetadata, Localized, OauthGrantType}, + registration::{ApplicationType, ClientMetadata, Localized, OAuthGrantType}, registrations::ClientId, AccountManagementActionFull, AuthorizationCode, AuthorizationResponse, CsrfToken, OAuthAuthorizationData, OAuthSession, UserSession, @@ -726,7 +726,7 @@ fn client_metadata() -> Raw { // browser). ApplicationType::Native, // We are going to use the Authorization Code flow. - vec![OauthGrantType::AuthorizationCode { + vec![OAuthGrantType::AuthorizationCode { redirect_uris: vec![ipv4_localhost_uri, ipv6_localhost_uri], }], client_uri, diff --git a/examples/qr-login/src/main.rs b/examples/qr-login/src/main.rs index dd201942f..22744f5f1 100644 --- a/examples/qr-login/src/main.rs +++ b/examples/qr-login/src/main.rs @@ -6,7 +6,7 @@ use futures_util::StreamExt; use matrix_sdk::{ authentication::oauth::{ qrcode::{LoginProgress, QrCodeData, QrCodeModeData}, - registration::{ApplicationType, ClientMetadata, Localized, OauthGrantType}, + registration::{ApplicationType, ClientMetadata, Localized, OAuthGrantType}, }, ruma::serde::Raw, Client, @@ -54,7 +54,7 @@ fn client_metadata() -> Raw { // browser). ApplicationType::Native, // We are going to use the Device Authorization flow. - vec![OauthGrantType::DeviceCode], + vec![OAuthGrantType::DeviceCode], client_uri, ) };