logging bad auth requests

This commit is contained in:
shockrah 2020-07-13 21:47:00 -07:00
parent 1eab32889a
commit 46403913a4

View File

@ -45,7 +45,7 @@ async fn route_dispatcher(pool: &Pool, resp: &mut Response<Body>, meth: &Method,
*resp.status_mut() = StatusCode::INTERNAL_SERVER_ERROR; *resp.status_mut() = StatusCode::INTERNAL_SERVER_ERROR;
} }
}, },
(&Method::POST, routes::CHANNELS_LIST) => channels::list_channels(pool, resp).await, (&Method::GET, routes::CHANNELS_LIST) => channels::list_channels(pool, resp).await,
(&Method::POST, routes::CHANNELS_CREATE) => channels::create_channel(pool, resp, params).await, (&Method::POST, routes::CHANNELS_CREATE) => channels::create_channel(pool, resp, params).await,
(&Method::POST, routes::MESSAGE_SEND) => messages::send_message(pool, resp, params).await, (&Method::POST, routes::MESSAGE_SEND) => messages::send_message(pool, resp, params).await,
@ -85,7 +85,10 @@ async fn main_responder(request: Request<Body>) -> Result<Response<Body>, hyper:
// Deal with permissions errors at this point // Deal with permissions errors at this point
match auth_result { match auth_result {
OpenAuth | Good => route_dispatcher(&pool, &mut response, &method, path, params).await, OpenAuth | Good => route_dispatcher(&pool, &mut response, &method, path, params).await,
NoKey => *response.status_mut() = StatusCode::UNAUTHORIZED, NoKey => {
println!("AUTH: NoKey/BadKey");
*response.status_mut() = StatusCode::UNAUTHORIZED
},
} }
} }
else { else {