2022-04-03 14:45:25 +00:00
|
|
|
use std::time::Duration;
|
|
|
|
|
2022-03-29 17:32:31 +00:00
|
|
|
/// File in storage containing users list
|
|
|
|
pub const USERS_LIST_FILE: &str = "users.json";
|
|
|
|
|
|
|
|
/// Default built-in credentials
|
|
|
|
pub const DEFAULT_ADMIN_USERNAME: &str = "admin";
|
2022-03-30 08:29:10 +00:00
|
|
|
pub const DEFAULT_ADMIN_PASSWORD: &str = "admin";
|
|
|
|
|
|
|
|
/// App name
|
2022-04-01 20:51:33 +00:00
|
|
|
pub const APP_NAME: &str = "Basic OIDC";
|
|
|
|
|
|
|
|
/// Maximum session duration after inactivity, in seconds
|
2022-04-02 15:17:54 +00:00
|
|
|
pub const MAX_INACTIVITY_DURATION: i64 = 60 * 30;
|
2022-04-01 20:51:33 +00:00
|
|
|
|
2022-04-02 15:17:54 +00:00
|
|
|
/// Maximum session duration (6 hours)
|
|
|
|
pub const MAX_SESSION_DURATION: i64 = 3600 * 6;
|
2022-04-02 06:30:01 +00:00
|
|
|
|
|
|
|
/// Minimum password length
|
2022-04-02 13:30:08 +00:00
|
|
|
pub const MIN_PASS_LEN: usize = 4;
|
|
|
|
|
2022-04-02 15:03:51 +00:00
|
|
|
/// The name of the cookie used to store session information
|
2022-04-02 15:44:10 +00:00
|
|
|
pub const SESSION_COOKIE_NAME: &str = "auth-cookie";
|
|
|
|
|
|
|
|
/// Authenticated routes prefix
|
|
|
|
pub const AUTHENTICATED_ROUTES: &str = "/settings";
|
|
|
|
|
|
|
|
/// Admin routes prefix
|
|
|
|
pub const ADMIN_ROUTES: &str = "/admin";
|
|
|
|
|
|
|
|
/// Auth route
|
2022-04-03 13:50:49 +00:00
|
|
|
pub const LOGIN_ROUTE: &str = "/login";
|
2022-04-03 14:21:09 +00:00
|
|
|
|
|
|
|
/// Bruteforce protection
|
|
|
|
pub const KEEP_FAILED_LOGIN_ATTEMPTS_FOR: u64 = 3600;
|
2022-04-03 15:33:01 +00:00
|
|
|
pub const MAX_FAILED_LOGIN_ATTEMPTS: usize = 15;
|
2022-04-03 14:45:25 +00:00
|
|
|
pub const FAIL_LOGIN_ATTEMPT_CLEANUP_INTERVAL: Duration = Duration::from_secs(60);
|