fix(appservices): don't perform identity assertion when auth is optional

Signed-off-by: strawberry <strawberry@puppygock.gay>
This commit is contained in:
strawberry 2024-04-23 17:11:30 -04:00 committed by June
parent 456a3f93bd
commit eb10e7d39b

View file

@ -132,7 +132,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(
@ -156,9 +156,10 @@ where
(Some(user_id), None, None, Some(*info))
},
(AuthScheme::None | AuthScheme::AppserviceToken, Token::Appservice(info)) => {
(None, None, None, Some(*info))
},
(
AuthScheme::None | AuthScheme::AccessTokenOptional | AuthScheme::AppserviceToken,
Token::Appservice(info),
) => (None, None, None, Some(*info)),
(AuthScheme::AccessToken, Token::None) => {
return Err(Error::BadRequest(ErrorKind::MissingToken, "Missing access token."));
},