port room directory auth to new auth stuff
Signed-off-by: strawberry <strawberry@puppygock.gay>
This commit is contained in:
parent
9b82551e63
commit
168858c8de
1 changed files with 27 additions and 0 deletions
|
@ -95,6 +95,33 @@ where
|
||||||
Token::None
|
Token::None
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if metadata.authentication == AuthScheme::None {
|
||||||
|
match parts.uri.path() {
|
||||||
|
// TODO: can we check this better?
|
||||||
|
"/_matrix/client/v3/publicRooms" | "/_matrix/client/r0/publicRooms" => {
|
||||||
|
if !services()
|
||||||
|
.globals
|
||||||
|
.config
|
||||||
|
.allow_public_room_directory_without_auth
|
||||||
|
{
|
||||||
|
match token {
|
||||||
|
Token::Appservice(_) | Token::User(_) => {
|
||||||
|
// we should have validated the token above
|
||||||
|
// already
|
||||||
|
},
|
||||||
|
Token::None | Token::Invalid => {
|
||||||
|
return Err(Error::BadRequest(
|
||||||
|
ErrorKind::MissingToken,
|
||||||
|
"Missing or invalid access token.",
|
||||||
|
));
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
_ => {},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
let mut json_body = serde_json::from_slice::<CanonicalJsonValue>(&body).ok();
|
let mut json_body = serde_json::from_slice::<CanonicalJsonValue>(&body).ok();
|
||||||
|
|
||||||
let (sender_user, sender_device, sender_servername, from_appservice) = match (metadata.authentication, token) {
|
let (sender_user, sender_device, sender_servername, from_appservice) = match (metadata.authentication, token) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue