client-api: Add MSC2965 feature and m.authentication discovery

This commit is contained in:
Doug 2022-06-16 19:56:16 +01:00 committed by GitHub
parent 11d926ed17
commit aae6fa2843
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 31 additions and 0 deletions

View File

@ -16,6 +16,7 @@ Improvements:
* Add unstable support for querying relating events (MSC2675)
* Move `filter::RelationType` to `ruma_common::events::relations`
* Add unstable support for discovering an OpenID Connect server (MSC2965)
# 0.14.1

View File

@ -26,6 +26,7 @@ unstable-msc2675 = []
unstable-msc2676 = []
unstable-msc2677 = []
unstable-msc2918 = []
unstable-msc2965 = []
unstable-msc3316 = []
unstable-msc3440 = []
unstable-msc3488 = []

View File

@ -32,6 +32,11 @@ ruma_api! {
#[cfg(feature = "unstable-msc3488")]
#[serde(rename = "org.matrix.msc3488.tile_server", alias = "m.tile_server")]
pub tile_server: Option<TileServerInfo>,
/// Information about the authentication server to connect to when using OpenID Connect.
#[cfg(feature = "unstable-msc2965")]
#[serde(rename = "m.authentication")]
pub authentication: Option<AuthenticationServerInfo>,
}
error: crate::Error
@ -52,6 +57,8 @@ impl Response {
identity_server: None,
#[cfg(feature = "unstable-msc3488")]
tile_server: None,
#[cfg(feature = "unstable-msc2965")]
authentication: None,
}
}
}
@ -104,3 +111,25 @@ impl TileServerInfo {
Self { map_style_url }
}
}
/// Information about a discovered authentication server.
#[cfg(feature = "unstable-msc2965")]
#[derive(Clone, Debug, Deserialize, Hash, Serialize)]
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
pub struct AuthenticationServerInfo {
/// The OIDC Provider that is trusted by the homeserver.
pub issuer: String,
/// The URL where the user is able to access the account management
/// capabilities of the OIDC Provider.
#[serde(skip_serializing_if = "Option::is_none")]
pub account: Option<String>,
}
#[cfg(feature = "unstable-msc2965")]
impl AuthenticationServerInfo {
/// Creates an `AuthenticationServerInfo` with the given `issuer` and an optional `account.
pub fn new(issuer: String, account: Option<String>) -> Self {
Self { issuer, account }
}
}