Skip to content

Commit 4ed5828

Browse files
committed
added:http basic support
1 parent 85bfee0 commit 4ed5828

File tree

13 files changed

+104
-10
lines changed

13 files changed

+104
-10
lines changed

XEngine_Release/XEngine_Config/XEngine_Config.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,10 @@
5454
"bEnable": false,
5555
"nPass": 123123
5656
},
57+
"XApiVer": {
58+
"bEnable": true,
59+
"nVerType": 1
60+
},
5761
"XSql": {
5862
"nSQLType": 0,
5963
"SQLAddr": "127.0.0.1",

XEngine_Source/AuthorizeModule_Configure/Config_Define.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,11 @@ typedef struct
8484
bool bEnable; //是否启用加密传输
8585
int nPassword; //密码
8686
}st_XCrypto;
87+
struct
88+
{
89+
bool bEnable; //是否启用HTTP接口权限验证
90+
int nVType; //验证方法,1 基本,2摘要
91+
}st_XApiVer;
8792
struct
8893
{
8994
int nDBType;

XEngine_Source/AuthorizeModule_Configure/Config_Error.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,5 @@
2020
#define ERROR_AUTHORIZE_MODULE_CONFIGURE_XLOG 0x0010008
2121
#define ERROR_AUTHORIZE_MODULE_CONFIGURE_MALLOC 0x0010009
2222
#define ERROR_AUTHORIZE_MODULE_CONFIGURE_REPORT 0x0010010
23-
#define ERROR_AUTHORIZE_MODULE_CONFIGURE_XTIME 0x0010011
23+
#define ERROR_AUTHORIZE_MODULE_CONFIGURE_XTIME 0x0010011
24+
#define ERROR_AUTHORIZE_MODULE_CONFIGURE_XAPIVER 0x0010012

XEngine_Source/AuthorizeModule_Configure/ModuleConfigure_Json/ModuleConfigure_Json.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,16 @@ bool CModuleConfigure_Json::ModuleConfigure_Json_File(LPCXSTR lpszConfigFile, XE
155155
Json::Value st_JsonXCrypto = st_JsonRoot["XCrypto"];
156156
pSt_ServerConfig->st_XCrypto.bEnable = st_JsonXCrypto["bEnable"].asBool();
157157
pSt_ServerConfig->st_XCrypto.nPassword = st_JsonXCrypto["nPass"].asInt();
158+
//接口验证
159+
if (st_JsonRoot["XApiVer"].empty() || (2 != st_JsonRoot["XApiVer"].size()))
160+
{
161+
Config_IsErrorOccur = true;
162+
Config_dwErrorCode = ERROR_AUTHORIZE_MODULE_CONFIGURE_XAPIVER;
163+
return false;
164+
}
165+
Json::Value st_JsonXAPIVer = st_JsonRoot["XApiVer"];
166+
pSt_ServerConfig->st_XApiVer.bEnable = st_JsonXAPIVer["bEnable"].asBool();
167+
pSt_ServerConfig->st_XApiVer.nVType = st_JsonXAPIVer["nVerType"].asInt();
158168
//数据库配置
159169
if (st_JsonRoot["XSql"].empty() || (6 != st_JsonRoot["XSql"].size()))
160170
{

XEngine_Source/AuthorizeModule_Help/AuthHelp_Define.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,13 @@ extern "C" bool AuthHelp_DynamicCode_Get(XNETHANDLE xhToken, int nDynamicCode);
101101
*********************************************************************/
102102
extern "C" bool AuthHelp_MultiLogin_GetRange(int nClientDevice, int* pInt_IDType);
103103
/************************************************************************/
104+
/* API帮助函数导出定义 */
105+
/************************************************************************/
106+
107+
extern "C" bool AuthHelp_APIHelp_HttpAuth(XCHAR* ptszUser, XCHAR* ptszPass, XCHAR** pptszListHdr, int nHdrCount);
108+
109+
extern "C" bool AuthHelp_APIHelp_Digest(XCHAR* ptszResponseStr, LPCXSTR lpszUser, LPCXSTR lpszPass, LPCXSTR lpszRealm, LPCXSTR lpszMethod, LPCXSTR lpszUrl, LPCXSTR lpszNonce, LPCXSTR lpszCNonce, LPCXSTR lpszNC = NULL);
110+
/************************************************************************/
104111
/* 剪贴板导出定义 */
105112
/************************************************************************/
106113
#ifdef _MSC_BUILD

XEngine_Source/AuthorizeModule_Help/AuthHelp_Error.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,10 @@
3838
/************************************************************************/
3939
/* 多端登录 */
4040
/************************************************************************/
41-
#define ERROR_AUTHORIZE_MODULE_HELP_MULTI_NOTSUPPORT 0x0050030 //不支持
41+
#define ERROR_AUTHORIZE_MODULE_HELP_MULTI_NOTSUPPORT 0x0050030 //不支持
42+
/************************************************************************/
43+
/* API帮助函数 */
44+
/************************************************************************/
45+
#define ERROR_AUTHORIZE_MODULE_HELP_APIHELP_NOTSUPPORT 0x0050040 //不支持
46+
#define ERROR_AUTHORIZE_MODULE_HELP_APIHELP_PARAMENT 0x0050041 //参数错误
47+
#define ERROR_AUTHORIZE_MODULE_HELP_APIHELP_FORMAT 0x0050042 //格式错误

XEngine_Source/AuthorizeModule_Help/AuthorizeModule_Help.def

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ EXPORTS
1010

1111
AuthHelp_MultiLogin_GetRange
1212

13+
AuthHelp_APIHelp_HttpAuth
14+
AuthHelp_APIHelp_Digest
15+
1316
AuthHelp_ClipBoard_Set
1417
AuthHelp_ClipBoard_Get
1518
AuthHelp_ClipBoard_Clear

XEngine_Source/AuthorizeModule_Help/AuthorizeModule_Help.vcxproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,7 @@
248248
</Link>
249249
</ItemDefinitionGroup>
250250
<ItemGroup>
251+
<ClInclude Include="AuthHelp_APIHelp\AuthHelp_APIHelp.h" />
251252
<ClInclude Include="AuthHelp_ClipBoard\AuthHelp_ClipBoard.h" />
252253
<ClInclude Include="AuthHelp_Define.h" />
253254
<ClInclude Include="AuthHelp_DynamicCode\AuthHelp_DynamicCode.h" />
@@ -258,6 +259,7 @@
258259
<ClInclude Include="pch.h" />
259260
</ItemGroup>
260261
<ItemGroup>
262+
<ClCompile Include="AuthHelp_APIHelp\AuthHelp_APIHelp.cpp" />
261263
<ClCompile Include="AuthHelp_ClipBoard\AuthHelp_ClipBoard.cpp" />
262264
<ClCompile Include="AuthHelp_DynamicCode\AuthHelp_DynamicCode.cpp" />
263265
<ClCompile Include="AuthHelp_MultiLogin\AuthHelp_MultiLogin.cpp" />

XEngine_Source/AuthorizeModule_Help/AuthorizeModule_Help.vcxproj.filters

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,12 @@
3737
<Filter Include="源文件\AuthHelp_MultiLogin">
3838
<UniqueIdentifier>{92e4cc9f-02d7-4e6d-92a1-86e433e38fd2}</UniqueIdentifier>
3939
</Filter>
40+
<Filter Include="头文件\AuthHelp_APIHelp">
41+
<UniqueIdentifier>{7dd61ed5-7869-47d3-98d7-e8bd46dbcc15}</UniqueIdentifier>
42+
</Filter>
43+
<Filter Include="源文件\AuthHelp_APIHelp">
44+
<UniqueIdentifier>{3d25ff0b-dc39-4507-b453-c2fd2084b370}</UniqueIdentifier>
45+
</Filter>
4046
</ItemGroup>
4147
<ItemGroup>
4248
<ClInclude Include="framework.h">
@@ -63,6 +69,9 @@
6369
<ClInclude Include="AuthHelp_MultiLogin\AuthHelp_MultiLogin.h">
6470
<Filter>头文件\AuthHelp_MultiLogin</Filter>
6571
</ClInclude>
72+
<ClInclude Include="AuthHelp_APIHelp\AuthHelp_APIHelp.h">
73+
<Filter>头文件\AuthHelp_APIHelp</Filter>
74+
</ClInclude>
6675
</ItemGroup>
6776
<ItemGroup>
6877
<ClCompile Include="dllmain.cpp">
@@ -83,6 +92,9 @@
8392
<ClCompile Include="AuthHelp_MultiLogin\AuthHelp_MultiLogin.cpp">
8493
<Filter>源文件\AuthHelp_MultiLogin</Filter>
8594
</ClCompile>
95+
<ClCompile Include="AuthHelp_APIHelp\AuthHelp_APIHelp.cpp">
96+
<Filter>源文件\AuthHelp_APIHelp</Filter>
97+
</ClCompile>
8698
</ItemGroup>
8799
<ItemGroup>
88100
<None Include="AuthorizeModule_Help.def">

XEngine_Source/AuthorizeModule_Help/pch.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#include "pch.h"
22
#include "AuthHelp_DynamicCode/AuthHelp_DynamicCode.h"
33
#include "AuthHelp_MultiLogin/AuthHelp_MultiLogin.h"
4+
#include "AuthHelp_APIHelp/AuthHelp_APIHelp.h"
45
#ifdef _MSC_BUILD
56
#include "AuthHelp_ClipBoard/AuthHelp_ClipBoard.h"
67
#include "AuthHelp_Windows/AuthHelp_Windows.h"
@@ -21,6 +22,7 @@ XLONG Help_dwErrorCode = 0;
2122
//////////////////////////////////////////////////////////////////////////
2223
CAuthHelp_DynamicCode m_HelpDynamic;
2324
CAuthHelp_MultiLogin m_HelpLogin;
25+
CAuthHelp_APIHelp m_APIHelp;
2426
#ifdef _MSC_BUILD
2527
CAuthHelp_ClipBoard m_HelpClipBoard;
2628
CAuthHelp_Windows m_HelpWindow;
@@ -61,6 +63,17 @@ extern "C" bool AuthHelp_MultiLogin_GetRange(int nClientDevice, int* pInt_IDType
6163
return m_HelpLogin.AuthHelp_MultiLogin_GetRange(nClientDevice, pInt_IDType);
6264
}
6365
/************************************************************************/
66+
/* API帮助函数导出定义 */
67+
/************************************************************************/
68+
extern "C" bool AuthHelp_APIHelp_HttpAuth(XCHAR* ptszUser, XCHAR* ptszPass, XCHAR** pptszListHdr, int nHdrCount)
69+
{
70+
return m_APIHelp.AuthHelp_APIHelp_HttpAuth(ptszUser, ptszPass, pptszListHdr, nHdrCount);
71+
}
72+
extern "C" bool AuthHelp_APIHelp_Digest(XCHAR* ptszResponseStr, LPCXSTR lpszUser, LPCXSTR lpszPass, LPCXSTR lpszRealm, LPCXSTR lpszMethod, LPCXSTR lpszUrl, LPCXSTR lpszNonce, LPCXSTR lpszCNonce, LPCXSTR lpszNC)
73+
{
74+
return m_APIHelp.AuthHelp_APIHelp_Digest(ptszResponseStr, lpszUser, lpszPass, lpszRealm, lpszMethod, lpszUser, lpszNonce, lpszCNonce, lpszNC);
75+
}
76+
/************************************************************************/
6477
/* 剪贴板导出定义 */
6578
/************************************************************************/
6679
#ifdef _MSC_BUILD

0 commit comments

Comments
 (0)