Automatically clean failed login attempts

This commit is contained in:
2022-04-03 16:45:25 +02:00
parent 05e911bfc5
commit 9943df4952
3 changed files with 26 additions and 6 deletions

View File

@ -1,11 +1,12 @@
use actix::Actor;
use actix_identity::{CookieIdentityPolicy, IdentityService};
use actix_web::cookie::time::Duration;
use actix_web::{App, get, HttpServer, web};
use actix_web::cookie::SameSite;
use actix_web::cookie::time::Duration;
use actix_web::middleware::Logger;
use actix_web::{get, web, App, HttpServer};
use clap::Parser;
use basic_oidc::actors::bruteforce_actor::BruteForceActor;
use basic_oidc::actors::users_actor::UsersActor;
use basic_oidc::constants::{
DEFAULT_ADMIN_PASSWORD, DEFAULT_ADMIN_USERNAME, MAX_INACTIVITY_DURATION, MAX_SESSION_DURATION,
@ -63,6 +64,7 @@ async fn main() -> std::io::Result<()> {
}
let users_actor = UsersActor::new(users).start();
let bruteforce_actor = BruteForceActor::default().start();
log::info!("Server will listen on {}", config.listen_address);
let listen_address = config.listen_address.to_string();
@ -77,6 +79,7 @@ async fn main() -> std::io::Result<()> {
App::new()
.app_data(web::Data::new(users_actor.clone()))
.app_data(web::Data::new(bruteforce_actor.clone()))
.app_data(web::Data::new(config.clone()))
.wrap(Logger::default())
.wrap(AuthMiddleware {})
@ -91,7 +94,7 @@ async fn main() -> std::io::Result<()> {
// Logout page
.route("/logout", web::get().to(logout_route))
})
.bind(listen_address)?
.run()
.await
.bind(listen_address)?
.run()
.await
}