diff --git a/CHANGELOG.md b/CHANGELOG.md index 35ec1476..57fed245 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,10 @@ Breaking changes: * Remove deprecated `home_server` response field (removed in r0.4.0) * Add `auth_parameters` to `r0::account::AuthenticationData` +Improvements: + +* Add types for User-Interactive Authentication API: `r0::account::{UserInteractiveAuthenticationInfo, AuthenticationFlow}` + # 0.7.2 Bug fixes: diff --git a/src/r0/account.rs b/src/r0/account.rs index 8b870bae..6598d76d 100644 --- a/src/r0/account.rs +++ b/src/r0/account.rs @@ -34,6 +34,31 @@ pub struct AuthenticationData { pub auth_parameters: BTreeMap, } +/// Information about available authentication flows and status for +/// User-Interactive Authenticiation API. +#[derive(Clone, Debug, Deserialize, Serialize)] +pub struct UserInteractiveAuthenticationInfo { + /// List of authentication flows available for this endpoint. + pub flows: Vec, + /// List of stages in the current flow completed by the client. + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub completed: Vec, + /// Authentication parameters required for the client to complete authentication. + pub params: serde_json::Value, + /// Session key for client to use to complete authentication. + #[serde(skip_serializing_if = "Option::is_none")] + pub session: Option, +} + +/// Description of steps required to authenticate via the User-Interactive +/// Authentication API. +#[derive(Clone, Debug, Deserialize, Serialize)] +pub struct AuthenticationFlow { + /// Ordered list of stages required to complete authentication. + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub stages: Vec, +} + /// Additional authentication information for requestToken endpoints. #[derive(Clone, Debug, Deserialize, Serialize)] pub struct IdentityServerInfo {