treat non-appservice registrations as None auth
Signed-off-by: strawberry <strawberry@puppygock.gay>
This commit is contained in:
parent
da9fdd2a60
commit
8cc23671e0
1 changed files with 2 additions and 22 deletions
|
@ -150,28 +150,8 @@ where
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// TODO: verify if this is correct for Appservices (?)
|
// treat non-appservice registrations as None authentication
|
||||||
AuthScheme::AppserviceToken => {
|
AuthScheme::AppserviceToken => (None, None, None, false),
|
||||||
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)
|
|
||||||
},
|
|
||||||
}
|
|
||||||
},
|
|
||||||
AuthScheme::ServerSignatures => {
|
AuthScheme::ServerSignatures => {
|
||||||
let TypedHeader(Authorization(x_matrix)) =
|
let TypedHeader(Authorization(x_matrix)) =
|
||||||
parts.extract::<TypedHeader<Authorization<XMatrix>>>().await.map_err(|e| {
|
parts.extract::<TypedHeader<Authorization<XMatrix>>>().await.map_err(|e| {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue