From e7bf3252bf0d2ef4ef316dc0534538d372b4879d Mon Sep 17 00:00:00 2001 From: hnu202326010310 <278879662@qq.com> Date: Mon, 29 Sep 2025 10:56:13 +0800 Subject: [PATCH] ADD file via upload --- src/auth_manager.h | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 src/auth_manager.h diff --git a/src/auth_manager.h b/src/auth_manager.h new file mode 100644 index 0000000..7047c81 --- /dev/null +++ b/src/auth_manager.h @@ -0,0 +1,23 @@ +#ifndef AUTH_MANAGER_H_ +#define AUTH_MANAGER_H_ + +#include +#include + +class AuthManager { + public: + AuthManager(); + + // 用户认证,返回认证结果并通过user_type输出用户类型 + bool Authenticate(const std::string& username, const std::string& password, + std::string* user_type); + + // 验证用户是否存在且密码正确 + bool IsValidUser(const std::string& username, const std::string& password); + + private: + // 存储账户信息:用户名 -> (密码, 用户类型) + std::unordered_map> accounts_; +}; + +#endif // AUTH_MANAGER_H_ \ No newline at end of file