Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions crates/cli/src/commands/doctor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -355,10 +355,15 @@ Error details: {e}

let has_compatibility_sso = flows.iter().any(|flow| {
flow.get("type").and_then(|t| t.as_str()) == Some("m.login.sso")
&& flow
.get("org.matrix.msc3824.delegated_oidc_compatibility")
&& (flow
.get("oauth_aware_preferred")
.and_then(serde_json::Value::as_bool)
== Some(true)
// we check for the unstable name too:
|| flow
.get("org.matrix.msc3824.delegated_oidc_compatibility")
.and_then(serde_json::Value::as_bool)
== Some(true))
});

if has_compatibility_sso {
Expand Down
13 changes: 10 additions & 3 deletions crates/handlers/src/compat/login.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,11 @@ enum LoginType {
Sso {
#[serde(skip_serializing_if = "Vec::is_empty")]
identity_providers: Vec<SsoIdentityProvider>,
oauth_aware_preferred: bool,
/// DEPRECATED: Use `oauth_aware_preferred` instead. We will remove this
/// once enough clients support the stable name `oauth_aware_preferred`.
#[serde(rename = "org.matrix.msc3824.delegated_oidc_compatibility")]
delegated_oidc_compatibility: bool,
unstable_delegated_oidc_compatibility: bool,
},
}

Expand All @@ -89,15 +92,17 @@ pub(crate) async fn get(State(password_manager): State<PasswordManager>) -> impl
LoginType::Password,
LoginType::Sso {
identity_providers: vec![],
delegated_oidc_compatibility: true,
oauth_aware_preferred: true,
unstable_delegated_oidc_compatibility: true,
},
LoginType::Token,
]
} else {
vec![
LoginType::Sso {
identity_providers: vec![],
delegated_oidc_compatibility: true,
oauth_aware_preferred: true,
unstable_delegated_oidc_compatibility: true,
},
LoginType::Token,
]
Expand Down Expand Up @@ -787,6 +792,7 @@ mod tests {
},
{
"type": "m.login.sso",
"oauth_aware_preferred": true,
"org.matrix.msc3824.delegated_oidc_compatibility": true
},
{
Expand Down Expand Up @@ -872,6 +878,7 @@ mod tests {
"flows": [
{
"type": "m.login.sso",
"oauth_aware_preferred": true,
"org.matrix.msc3824.delegated_oidc_compatibility": true
},
{
Expand Down
7 changes: 5 additions & 2 deletions crates/router/src/endpoints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -619,8 +619,11 @@ pub enum CompatLoginSsoAction {

#[derive(Debug, Serialize, Deserialize, Clone, Copy)]
pub struct CompatLoginSsoActionParams {
#[serde(rename = "org.matrix.msc3824.action")]
action: CompatLoginSsoAction,
/// DEPRECATED: Use `action` instead. We will remove this once enough
/// clients support the stable name.
#[serde(rename = "org.matrix.msc3824.action")]
unstable_action: CompatLoginSsoAction,
}

/// `GET|POST /complete-compat-sso/{id}`
Expand All @@ -634,7 +637,7 @@ impl CompatLoginSsoComplete {
pub fn new(id: Ulid, action: Option<CompatLoginSsoAction>) -> Self {
Self {
id,
query: action.map(|action| CompatLoginSsoActionParams { action }),
query: action.map(|action| CompatLoginSsoActionParams { action, unstable_action: action }),
}
}
}
Expand Down
Loading