Can set a list of allowed IP
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2024-04-23 19:29:11 +02:00
parent 9d738285ab
commit 9365e9afdf
3 changed files with 38 additions and 3 deletions

View File

@ -67,6 +67,16 @@ where
.await
.unwrap();
if !AppConfig::get().is_allowed_ip(remote_ip.0) {
log::error!("An attempt to access VirtWeb from an unauthorized network has been intercepted! {:?}", remote_ip);
return Ok(req
.into_response(
HttpResponse::MethodNotAllowed()
.json("I am sorry, but your IP is not allowed to access this service!"),
)
.map_into_right_body());
}
let auth_disabled = AppConfig::get().unsecure_disable_auth;
// Check API authentication