mirror of
https://github.com/matrix-construct/construct
synced 2024-11-29 10:12:39 +01:00
ircd: Propagate better error back to user here for now.
This commit is contained in:
parent
9f6eda4c3d
commit
a9dabd661b
1 changed files with 22 additions and 5 deletions
|
@ -173,6 +173,7 @@ void
|
|||
ircd::verify_origin(client &client,
|
||||
resource::method &method,
|
||||
resource::request &request)
|
||||
try
|
||||
{
|
||||
const auto &authorization
|
||||
{
|
||||
|
@ -189,11 +190,27 @@ ircd::verify_origin(client &client,
|
|||
m::verify_x_matrix_authorization(authorization, method.name, uri, request.content)
|
||||
};
|
||||
|
||||
if(!verified)
|
||||
throw m::error
|
||||
{
|
||||
http::UNAUTHORIZED, "M_INVALID_SIGNATURE", "The X-Matrix Authorization is invalid."
|
||||
};
|
||||
if(verified)
|
||||
return;
|
||||
|
||||
throw m::error
|
||||
{
|
||||
http::UNAUTHORIZED, "M_INVALID_SIGNATURE",
|
||||
"The X-Matrix Authorization is invalid."
|
||||
};
|
||||
}
|
||||
catch(const m::error &)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
catch(const std::exception &e)
|
||||
{
|
||||
throw m::error
|
||||
{
|
||||
http::UNAUTHORIZED, "M_INTERNAL_ERROR",
|
||||
"An error has prevented authorization: %s",
|
||||
e.what()
|
||||
};
|
||||
}
|
||||
|
||||
void
|
||||
|
|
Loading…
Reference in a new issue