【更新】授权模块
This commit is contained in:
@@ -5,7 +5,7 @@ std::string AppCfg::m_work_path="";
|
||||
std::string AppCfg::m_license="";
|
||||
float AppCfg::m_face_match_threshold = 0.78f;
|
||||
void AppCfg::SetWorkPath(const std::string& work_path) {
|
||||
|
||||
m_work_path = work_path;
|
||||
}
|
||||
|
||||
const std::string AppCfg::GetWorkPath() {
|
||||
@@ -18,6 +18,6 @@ bool AppCfg::SetLicense(const std::string& license) {
|
||||
}
|
||||
|
||||
void AppCfg::SetFaceMatchThreshold(float threshold) {
|
||||
|
||||
m_face_match_threshold = threshold;
|
||||
}
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#include <vector>
|
||||
#include "openssl/aes.h"
|
||||
#include "AuthModule.h"
|
||||
#include "DeviceInfo.h"
|
||||
#include "Base64.h"
|
||||
#include "HttpRequest.h"
|
||||
// 获取时间戳
|
||||
@@ -115,8 +116,7 @@ void TimeInfo::Show() {
|
||||
}
|
||||
|
||||
AuthInfo::AuthInfo() :
|
||||
m_type(AUTH_TYPE_INVALID) {
|
||||
}
|
||||
m_type(AUTH_TYPE_INVALID) { }
|
||||
|
||||
AuthInfo::AuthInfo(const std::string& key_data) {
|
||||
std::istringstream iss(key_data);
|
||||
@@ -144,6 +144,7 @@ AuthInfo::AuthInfo(const std::string& key_data) {
|
||||
|
||||
|
||||
ret_t AuthModule::CheckKey(const std::string& key) {
|
||||
|
||||
return RET_AUTH_FAILED;
|
||||
}
|
||||
|
||||
@@ -161,6 +162,7 @@ ret_t AuthModule::CheckKeyFile(const std::string& key_file) {
|
||||
break;
|
||||
case AUTH_TYPE_OFFLINE_MAC:
|
||||
ret = CheckOfflineMac();
|
||||
break;
|
||||
case AUTH_TYPE_ONLINE:
|
||||
ret = CheckOnline();
|
||||
break;
|
||||
@@ -242,6 +244,14 @@ ret_t AuthModule::CheckOfflineTime() {
|
||||
}
|
||||
|
||||
ret_t AuthModule::CheckOfflineMac() {
|
||||
std::vector<std::string> mac_list = DeviceInfo::GetInstance().GetMacAddress();
|
||||
for (auto& mac : mac_list) {
|
||||
for (auto& auth_mac : m_auth_info.m_mac_list) {
|
||||
if (mac == auth_mac) {
|
||||
return RET_OK;
|
||||
}
|
||||
}
|
||||
}
|
||||
return RET_AUTH_FAILED;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user