|
|
|
|
@ -1,23 +0,0 @@
|
|
|
|
|
#ifndef AUTH_MANAGER_H_
|
|
|
|
|
#define AUTH_MANAGER_H_
|
|
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
|
#include <unordered_map>
|
|
|
|
|
|
|
|
|
|
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<std::string, std::pair<std::string, std::string>> accounts_;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
#endif // AUTH_MANAGER_H_
|