You've already forked authentication-service
mirror of
https://github.com/matrix-org/matrix-authentication-service.git
synced 2025-08-07 17:03:01 +03:00
Implement account management discovery as per MSC2965
This commit is contained in:
@@ -34,6 +34,10 @@ struct DiscoveryResponse {
|
||||
|
||||
#[serde(rename = "org.matrix.matrix-authentication-service.graphql_endpoint")]
|
||||
graphql_endpoint: url::Url,
|
||||
|
||||
// As per MSC2965
|
||||
account_management_uri: url::Url,
|
||||
account_management_actions_supported: Vec<String>,
|
||||
}
|
||||
|
||||
#[tracing::instrument(name = "handlers.oauth2.discovery.get", skip_all)]
|
||||
@@ -168,6 +172,15 @@ pub(crate) async fn get(
|
||||
Json(DiscoveryResponse {
|
||||
standard,
|
||||
graphql_endpoint: url_builder.graphql_endpoint(),
|
||||
account_management_uri: url_builder.account_management_uri(),
|
||||
// This needs to be kept in sync with what is supported in the frontend,
|
||||
// see frontend/src/routing/actions.ts
|
||||
account_management_actions_supported: vec![
|
||||
"org.matrix.profile".to_owned(),
|
||||
"org.matrix.sessions_list".to_owned(),
|
||||
"org.matrix.session_view".to_owned(),
|
||||
"org.matrix.session_end".to_owned(),
|
||||
],
|
||||
})
|
||||
}
|
||||
|
||||
|
@@ -429,11 +429,26 @@ impl AccountAddEmail {
|
||||
|
||||
/// Actions parameters as defined by MSC2965
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "snake_case", tag = "action")]
|
||||
#[serde(tag = "action")]
|
||||
pub enum AccountAction {
|
||||
#[serde(rename = "org.matrix.profile")]
|
||||
OrgMatrixProfile,
|
||||
#[serde(rename = "profile")]
|
||||
Profile,
|
||||
|
||||
#[serde(rename = "org.matrix.sessions_list")]
|
||||
OrgMatrixSessionsList,
|
||||
#[serde(rename = "sessions_list")]
|
||||
SessionsList,
|
||||
|
||||
#[serde(rename = "org.matrix.session_view")]
|
||||
OrgMatrixSessionView { device_id: String },
|
||||
#[serde(rename = "session_view")]
|
||||
SessionView { device_id: String },
|
||||
|
||||
#[serde(rename = "org.matrix.session_end")]
|
||||
OrgMatrixSessionEnd { device_id: String },
|
||||
#[serde(rename = "session_end")]
|
||||
SessionEnd { device_id: String },
|
||||
}
|
||||
|
||||
|
@@ -195,6 +195,12 @@ impl UrlBuilder {
|
||||
pub fn upstream_oauth_authorize(&self, id: Ulid) -> Url {
|
||||
self.absolute_url_for(&crate::endpoints::UpstreamOAuth2Authorize::new(id))
|
||||
}
|
||||
|
||||
/// Account management URI
|
||||
#[must_use]
|
||||
pub fn account_management_uri(&self) -> Url {
|
||||
self.absolute_url_for(&crate::endpoints::Account::default())
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
Reference in New Issue
Block a user