From 8cc23671e0a0a97315f132f14037208e04f29c63 Mon Sep 17 00:00:00 2001 From: strawberry Date: Thu, 14 Mar 2024 19:49:12 -0400 Subject: [PATCH] treat non-appservice registrations as None auth Signed-off-by: strawberry --- src/api/ruma_wrapper/axum.rs | 24 ++---------------------- 1 file changed, 2 insertions(+), 22 deletions(-) diff --git a/src/api/ruma_wrapper/axum.rs b/src/api/ruma_wrapper/axum.rs index 47b67c10..a208a359 100644 --- a/src/api/ruma_wrapper/axum.rs +++ b/src/api/ruma_wrapper/axum.rs @@ -150,28 +150,8 @@ where } } }, - // TODO: verify if this is correct for Appservices (?) - AuthScheme::AppserviceToken => { - debug!("non-appservice called an endpoint with AuthScheme::AppserviceToken"); - let token = match token { - Some(token) => token, - _ => return Err(Error::BadRequest(ErrorKind::MissingToken, "Missing access token.")), - }; - - match services().users.find_from_token(token)? { - None => { - return Err(Error::BadRequest( - ErrorKind::UnknownToken { - soft_logout: false, - }, - "Unknown access token.", - )) - }, - Some((user_id, device_id)) => { - (Some(user_id), Some(OwnedDeviceId::from(device_id)), None, false) - }, - } - }, + // treat non-appservice registrations as None authentication + AuthScheme::AppserviceToken => (None, None, None, false), AuthScheme::ServerSignatures => { let TypedHeader(Authorization(x_matrix)) = parts.extract::>>().await.map_err(|e| {