Skip to content

Commit b9c970d

Browse files
zecakehbnjbvr
authored andcommitted
refactor(oauth): Rename OauthGrantType to OAuthGrantType
For consistency. Signed-off-by: Kévin Commaille <[email protected]>
1 parent ba5e395 commit b9c970d

File tree

6 files changed

+21
-21
lines changed

6 files changed

+21
-21
lines changed

bindings/matrix-sdk-ffi/src/authentication.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use std::{
88
use matrix_sdk::{
99
authentication::oauth::{
1010
error::OAuthAuthorizationCodeError,
11-
registration::{ApplicationType, ClientMetadata, Localized, OauthGrantType},
11+
registration::{ApplicationType, ClientMetadata, Localized, OAuthGrantType},
1212
registrations::{ClientId, OidcRegistrations, OidcRegistrationsError},
1313
OAuthError as SdkOAuthError,
1414
},
@@ -156,8 +156,8 @@ impl OidcConfiguration {
156156
..ClientMetadata::new(
157157
ApplicationType::Native,
158158
vec![
159-
OauthGrantType::AuthorizationCode { redirect_uris: vec![redirect_uri] },
160-
OauthGrantType::DeviceCode,
159+
OAuthGrantType::AuthorizationCode { redirect_uris: vec![redirect_uri] },
160+
OAuthGrantType::DeviceCode,
161161
],
162162
client_uri,
163163
)

crates/matrix-sdk/src/authentication/oauth/registration.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ pub struct ClientMetadata {
111111
/// The grant types that the client will use at the token endpoint.
112112
///
113113
/// This should match the login methods that the client can use.
114-
pub grant_types: Vec<OauthGrantType>,
114+
pub grant_types: Vec<OAuthGrantType>,
115115

116116
/// URL of the home page of the client.
117117
pub client_uri: Localized<Url>,
@@ -135,7 +135,7 @@ impl ClientMetadata {
135135
/// Construct a `ClientMetadata` with only the required fields.
136136
pub fn new(
137137
application_type: ApplicationType,
138-
grant_types: Vec<OauthGrantType>,
138+
grant_types: Vec<OAuthGrantType>,
139139
client_uri: Localized<Url>,
140140
) -> Self {
141141
Self {
@@ -157,7 +157,7 @@ impl ClientMetadata {
157157
/// [`OAuth`]: super::OAuth
158158
#[derive(Debug, Clone)]
159159
#[non_exhaustive]
160-
pub enum OauthGrantType {
160+
pub enum OAuthGrantType {
161161
/// The authorization code grant type, defined in [RFC 6749].
162162
///
163163
/// This grant type is necessary to use the [`OAuth::login()`] and
@@ -270,12 +270,12 @@ impl From<ClientMetadata> for ClientMetadataSerializeHelper {
270270

271271
for oauth_grant_type in oauth_grant_types {
272272
match oauth_grant_type {
273-
OauthGrantType::AuthorizationCode { redirect_uris: uris } => {
273+
OAuthGrantType::AuthorizationCode { redirect_uris: uris } => {
274274
redirect_uris = Some(uris);
275275
response_types = Some(vec![ResponseType::Code]);
276276
grant_types.insert(GrantType::AuthorizationCode);
277277
}
278-
OauthGrantType::DeviceCode => {
278+
OAuthGrantType::DeviceCode => {
279279
grant_types.insert(GrantType::DeviceCode);
280280
}
281281
}
@@ -360,13 +360,13 @@ mod tests {
360360
use serde_json::json;
361361
use url::Url;
362362

363-
use super::{ApplicationType, ClientMetadata, Localized, OauthGrantType};
363+
use super::{ApplicationType, ClientMetadata, Localized, OAuthGrantType};
364364

365365
#[test]
366366
fn test_serialize_minimal_client_metadata() {
367367
let metadata = ClientMetadata::new(
368368
ApplicationType::Native,
369-
vec![OauthGrantType::AuthorizationCode {
369+
vec![OAuthGrantType::AuthorizationCode {
370370
redirect_uris: vec![Url::parse("http://127.0.0.1/").unwrap()],
371371
}],
372372
Localized::new(
@@ -396,13 +396,13 @@ mod tests {
396396
let mut metadata = ClientMetadata::new(
397397
ApplicationType::Web,
398398
vec![
399-
OauthGrantType::AuthorizationCode {
399+
OAuthGrantType::AuthorizationCode {
400400
redirect_uris: vec![
401401
Url::parse("http://127.0.0.1/").unwrap(),
402402
Url::parse("http://[::1]/").unwrap(),
403403
],
404404
},
405-
OauthGrantType::DeviceCode,
405+
OAuthGrantType::DeviceCode,
406406
],
407407
Localized::new(
408408
Url::parse("https://example.org/matrix-client").unwrap(),

crates/matrix-sdk/src/authentication/oauth/registrations.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ mod tests {
166166
use tempfile::tempdir;
167167

168168
use super::*;
169-
use crate::authentication::oauth::registration::{ApplicationType, Localized, OauthGrantType};
169+
use crate::authentication::oauth::registration::{ApplicationType, Localized, OAuthGrantType};
170170

171171
#[test]
172172
fn test_oidc_registrations() {
@@ -245,7 +245,7 @@ mod tests {
245245

246246
let mut metadata = ClientMetadata::new(
247247
ApplicationType::Web,
248-
vec![OauthGrantType::AuthorizationCode { redirect_uris: vec![callback_url] }],
248+
vec![OAuthGrantType::AuthorizationCode { redirect_uris: vec![callback_url] }],
249249
Localized::new(client_uri, None),
250250
);
251251
metadata.client_name = Some(Localized::new(client_name, None));

crates/matrix-sdk/src/test_utils/client.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ pub mod oauth {
179179

180180
use crate::{
181181
authentication::oauth::{
182-
registration::{ApplicationType, ClientMetadata, Localized, OauthGrantType},
182+
registration::{ApplicationType, ClientMetadata, Localized, OAuthGrantType},
183183
registrations::ClientId,
184184
OAuthSession, UserSession,
185185
},
@@ -205,8 +205,8 @@ pub mod oauth {
205205
let mut metadata = ClientMetadata::new(
206206
ApplicationType::Native,
207207
vec![
208-
OauthGrantType::AuthorizationCode { redirect_uris: vec![mock_redirect_uri()] },
209-
OauthGrantType::DeviceCode,
208+
OAuthGrantType::AuthorizationCode { redirect_uris: vec![mock_redirect_uri()] },
209+
OAuthGrantType::DeviceCode,
210210
],
211211
Localized::new(client_uri, None),
212212
);

examples/oidc_cli/src/main.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ use anyhow::{anyhow, bail};
2323
use futures_util::StreamExt;
2424
use matrix_sdk::{
2525
authentication::oauth::{
26-
registration::{ApplicationType, ClientMetadata, Localized, OauthGrantType},
26+
registration::{ApplicationType, ClientMetadata, Localized, OAuthGrantType},
2727
registrations::ClientId,
2828
AccountManagementActionFull, AuthorizationCode, AuthorizationResponse, CsrfToken,
2929
OAuthAuthorizationData, OAuthSession, UserSession,
@@ -726,7 +726,7 @@ fn client_metadata() -> Raw<ClientMetadata> {
726726
// browser).
727727
ApplicationType::Native,
728728
// We are going to use the Authorization Code flow.
729-
vec![OauthGrantType::AuthorizationCode {
729+
vec![OAuthGrantType::AuthorizationCode {
730730
redirect_uris: vec![ipv4_localhost_uri, ipv6_localhost_uri],
731731
}],
732732
client_uri,

examples/qr-login/src/main.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use futures_util::StreamExt;
66
use matrix_sdk::{
77
authentication::oauth::{
88
qrcode::{LoginProgress, QrCodeData, QrCodeModeData},
9-
registration::{ApplicationType, ClientMetadata, Localized, OauthGrantType},
9+
registration::{ApplicationType, ClientMetadata, Localized, OAuthGrantType},
1010
},
1111
ruma::serde::Raw,
1212
Client,
@@ -54,7 +54,7 @@ fn client_metadata() -> Raw<ClientMetadata> {
5454
// browser).
5555
ApplicationType::Native,
5656
// We are going to use the Device Authorization flow.
57-
vec![OauthGrantType::DeviceCode],
57+
vec![OAuthGrantType::DeviceCode],
5858
client_uri,
5959
)
6060
};

0 commit comments

Comments
 (0)