implement /login/get_token (MSC3882)

This commit is contained in:
Jade Ellis 2025-01-11 18:49:21 +00:00 committed by June Clementine Strawberry 🍓🦴
parent afe9e5536b
commit 2cc6ad8df3
7 changed files with 196 additions and 24 deletions

View file

@ -767,6 +767,24 @@ pub struct Config {
#[serde(default = "default_openid_token_ttl")]
pub openid_token_ttl: u64,
/// Allow an existing session to mint a login token for another client.
/// This requires interactive authentication, but has security ramifications
/// as a malicious client could use the mechanism to spawn more than one
/// session.
/// Enabled by default.
#[serde(default = "true_fn")]
pub login_via_existing_session: bool,
/// Login token expiration/TTL in milliseconds.
///
/// These are short-lived tokens for the m.login.token endpoint.
/// This is used to allow existing sessions to create new sessions.
/// see login_via_existing_session.
///
/// default: 120000
#[serde(default = "default_login_token_ttl")]
pub login_token_ttl: u64,
/// Static TURN username to provide the client if not using a shared secret
/// ("turn_secret"), It is recommended to use a shared secret over static
/// credentials.
@ -2373,6 +2391,8 @@ fn default_notification_push_path() -> String { "/_matrix/push/v1/notify".to_own
fn default_openid_token_ttl() -> u64 { 60 * 60 }
fn default_login_token_ttl() -> u64 { 2 * 60 * 1000 }
fn default_turn_ttl() -> u64 { 60 * 60 * 24 }
fn default_presence_idle_timeout_s() -> u64 { 5 * 60 }