From 6c9c1b5afe23e136d20bcb121a0258559ce70d2f Mon Sep 17 00:00:00 2001 From: Matthias Ahouansou Date: Mon, 22 Apr 2024 10:32:33 +0100 Subject: [PATCH] fix(appservices): don't perform identity assertion when auth is optional --- src/api/ruma_wrapper/axum.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/api/ruma_wrapper/axum.rs b/src/api/ruma_wrapper/axum.rs index b3494721..af2dbeb6 100644 --- a/src/api/ruma_wrapper/axum.rs +++ b/src/api/ruma_wrapper/axum.rs @@ -107,10 +107,7 @@ where "Unknown access token.", )) } - ( - AuthScheme::AccessToken | AuthScheme::AccessTokenOptional, - Token::Appservice(info), - ) => { + (AuthScheme::AccessToken, Token::Appservice(info)) => { let user_id = query_params .user_id .map_or_else( @@ -135,9 +132,12 @@ where // TODO: Check if appservice is allowed to be that user (Some(user_id), None, None, true) } - (AuthScheme::None | AuthScheme::AppserviceToken, Token::Appservice(_)) => { - (None, None, None, true) - } + ( + AuthScheme::None + | AuthScheme::AppserviceToken + | AuthScheme::AccessTokenOptional, + Token::Appservice(_), + ) => (None, None, None, true), (AuthScheme::AccessToken, Token::None) => { return Err(Error::BadRequest( ErrorKind::MissingToken,