25 ,
public std::enable_shared_from_this<AuthService>
29 std::shared_ptr<Property<std::chrono::seconds>> m_scheduleRate;
30 std::shared_ptr<Property<std::chrono::minutes>> m_timeoutLogin;
31 std::shared_ptr<Property<int32_t>> m_maxLoginFailures;
32 std::shared_ptr<Property<std::chrono::seconds>> m_loginLockout;
33 std::shared_ptr<Property<int32_t>> m_maxLoginAttempts;
34 std::shared_ptr<Property<std::chrono::seconds>> m_rateLimitWindow;
36 std::map<std::string, UserToken> m_userTokens;
41 std::deque<std::chrono::steady_clock::time_point> m_timestamps;
43 std::map<std::string, FailedAttempt> m_failedAttempts;
45 std::map<std::string, std::deque<std::chrono::steady_clock::time_point>> m_loginAttempts;
46 std::shared_ptr<UserRepository> m_userRepository;
47 std::shared_ptr<SchedulerService> m_scheduler;
48 std::atomic_bool m_running =
true;
54 bool isLockedOut(
const std::string &
ipAddress);
57 void recordFailedLogin(
const std::string &
ipAddress);
60 void clearFailedLogins(
const std::string &
ipAddress);
63 bool allowLoginAttempt(
const std::string &
ipAddress);
66 void pruneLoginAttempts();
69 void pruneFailedLogins();