Skip to content
Snippets Groups Projects
Commit eb10e7d3 authored by 🥺's avatar 🥺 :transgender_flag: Committed by 🥺
Browse files

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

parent 456a3f93
No related branches found
No related tags found
No related merge requests found
...@@ -132,7 +132,7 @@ async fn from_request(req: Request<axum::body::Body>, _state: &S) -> Result<Self ...@@ -132,7 +132,7 @@ async fn from_request(req: Request<axum::body::Body>, _state: &S) -> Result<Self
"Unknown access token.", "Unknown access token.",
)) ))
}, },
(AuthScheme::AccessToken | AuthScheme::AccessTokenOptional, Token::Appservice(info)) => { (AuthScheme::AccessToken, Token::Appservice(info)) => {
let user_id = query_params let user_id = query_params
.user_id .user_id
.map_or_else( .map_or_else(
...@@ -156,9 +156,10 @@ async fn from_request(req: Request<axum::body::Body>, _state: &S) -> Result<Self ...@@ -156,9 +156,10 @@ async fn from_request(req: Request<axum::body::Body>, _state: &S) -> Result<Self
(Some(user_id), None, None, Some(*info)) (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) => { (AuthScheme::AccessToken, Token::None) => {
return Err(Error::BadRequest(ErrorKind::MissingToken, "Missing access token.")); return Err(Error::BadRequest(ErrorKind::MissingToken, "Missing access token."));
}, },
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment