Skip to content

Commit dcac8dc

Browse files
committed
Support for stable MSC3824 names
1 parent 55e4100 commit dcac8dc

File tree

3 files changed

+25
-7
lines changed

3 files changed

+25
-7
lines changed

crates/cli/src/commands/doctor.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -355,10 +355,15 @@ Error details: {e}
355355

356356
let has_compatibility_sso = flows.iter().any(|flow| {
357357
flow.get("type").and_then(|t| t.as_str()) == Some("m.login.sso")
358-
&& flow
359-
.get("org.matrix.msc3824.delegated_oidc_compatibility")
358+
&& (flow
359+
.get("oauth_aware_preferred")
360360
.and_then(serde_json::Value::as_bool)
361361
== Some(true)
362+
// we check for the unstable name too:
363+
|| flow
364+
.get("org.matrix.msc3824.delegated_oidc_compatibility")
365+
.and_then(serde_json::Value::as_bool)
366+
== Some(true))
362367
});
363368

364369
if has_compatibility_sso {

crates/handlers/src/compat/login.rs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,11 @@ enum LoginType {
6666
Sso {
6767
#[serde(skip_serializing_if = "Vec::is_empty")]
6868
identity_providers: Vec<SsoIdentityProvider>,
69+
oauth_aware_preferred: bool,
70+
/// DEPRECATED: Use `oauth_aware_preferred` instead. We will remove this
71+
/// once enough clients support the stable name `oauth_aware_preferred`.
6972
#[serde(rename = "org.matrix.msc3824.delegated_oidc_compatibility")]
70-
delegated_oidc_compatibility: bool,
73+
unstable_delegated_oidc_compatibility: bool,
7174
},
7275
}
7376

@@ -89,15 +92,17 @@ pub(crate) async fn get(State(password_manager): State<PasswordManager>) -> impl
8992
LoginType::Password,
9093
LoginType::Sso {
9194
identity_providers: vec![],
92-
delegated_oidc_compatibility: true,
95+
oauth_aware_preferred: true,
96+
unstable_delegated_oidc_compatibility: true,
9397
},
9498
LoginType::Token,
9599
]
96100
} else {
97101
vec![
98102
LoginType::Sso {
99103
identity_providers: vec![],
100-
delegated_oidc_compatibility: true,
104+
oauth_aware_preferred: true,
105+
unstable_delegated_oidc_compatibility: true,
101106
},
102107
LoginType::Token,
103108
]
@@ -787,6 +792,7 @@ mod tests {
787792
},
788793
{
789794
"type": "m.login.sso",
795+
"oauth_aware_preferred": true,
790796
"org.matrix.msc3824.delegated_oidc_compatibility": true
791797
},
792798
{
@@ -872,6 +878,7 @@ mod tests {
872878
"flows": [
873879
{
874880
"type": "m.login.sso",
881+
"oauth_aware_preferred": true,
875882
"org.matrix.msc3824.delegated_oidc_compatibility": true
876883
},
877884
{

crates/router/src/endpoints.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -619,8 +619,11 @@ pub enum CompatLoginSsoAction {
619619

620620
#[derive(Debug, Serialize, Deserialize, Clone, Copy)]
621621
pub struct CompatLoginSsoActionParams {
622-
#[serde(rename = "org.matrix.msc3824.action")]
623622
action: CompatLoginSsoAction,
623+
/// DEPRECATED: Use `action` instead. We will remove this once enough
624+
/// clients support the stable name.
625+
#[serde(rename = "org.matrix.msc3824.action")]
626+
unstable_action: CompatLoginSsoAction,
624627
}
625628

626629
/// `GET|POST /complete-compat-sso/{id}`
@@ -634,7 +637,10 @@ impl CompatLoginSsoComplete {
634637
pub fn new(id: Ulid, action: Option<CompatLoginSsoAction>) -> Self {
635638
Self {
636639
id,
637-
query: action.map(|action| CompatLoginSsoActionParams { action }),
640+
query: action.map(|action| CompatLoginSsoActionParams {
641+
action,
642+
unstable_action: action,
643+
}),
638644
}
639645
}
640646
}

0 commit comments

Comments
 (0)