123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201 |
- function onenet_guid()
- {
- return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
- var r = Math.random()*16|0, v = c == 'x' ? r : (r&0x3|0x8);
- return v.toString(16);
- });
-
- }
- function InitCmdMsg(action, data)
- {
- var msg = {};
- msg['logid'] = onenet_guid();
- msg['action'] = action;
- msg['data'] = data;
- return msg;
- }
-
- var oneNetHelper_activex=new Object();
- oneNetHelper_activex.isAvailable = false;
- oneNetHelper_activex.IsAddonAvailable = function ()
- {
- if(!oneNetHelper_activex.isAvailable)
- {
- oneNetHelper_activex.isAvailable = (AuthClientCtrl)? true : false;
- if(oneNetHelper_activex.isAvailable)
- {
- try
- {
- AuthClientCtrl.Test();
- }
- catch(e)
- {
- oneNetHelper_activex.isAvailable = false;
- alert("AuthClientCtrl.Test失败!");
- }
- }
- else
- {
- alert("加载AuthClientCtrl 对象失败!");
- }
- }
-
-
- return oneNetHelper_activex.isAvailable;
- }
-
- oneNetHelper_activex.AddonAvailableNotify = function (notify_web)
- {
- setTimeout(function (){
- var resp = {};
- resp['addon']=oneNetHelper_activex.isAvailable;
- notify_web(resp);
- }, 0);
- }
-
- oneNetHelper_activex.GetUASToken = function (notify_web)
- {
- setTimeout(function (){
- var resp = {};
- AuthClientCtrl.GetUASToken();
- resp['ret'] = AuthClientCtrl.lResult == 0 ? 1 : 0;
- resp['errinfo'] = AuthClientCtrl.bstrError;
- resp['token'] = AuthClientCtrl.bstrUASToken;
- resp['expiredate'] = AuthClientCtrl.bstrUASExpireDate;
- notify_web(resp);
- }, 0);
- }
- oneNetHelper_activex.GetUserInfo = function (notify_web)
- {
- setTimeout(function (){
- var resp = {};
- AuthClientCtrl.GetUserInfo();
- resp['ret'] = AuthClientCtrl.lResult == 0 ? 1 : 0;
- resp['errinfo'] = AuthClientCtrl.bstrError;
- resp['userid'] = AuthClientCtrl.bstrUserID;
- resp['username'] = AuthClientCtrl.bstrUserName;
- resp['certuserid'] = AuthClientCtrl.bstrCertUserID;
- resp['certusername'] = AuthClientCtrl.bstrCertUserName;
- resp['authresult'] = AuthClientCtrl.lAuthResult;
- notify_web(resp);
- }, 0);
- }
-
- oneNetHelper_activex.GetSignAndToken = function (randomnum, notify_web)
- {
- setTimeout(function (){
- var hostname = location.hostname;
- var msg = InitCmdMsg("GetSignAndToken", randomnum);
- msg['appServerAddr'] = hostname;
- var resp = {};
- AuthClientCtrl.JsonActionCmdDeal(JSON.stringify(msg));
- var obj = JSON.parse(AuthClientCtrl.bstrResponse);
- resp = obj.info;
- /*说明:1.针对老版本客户端底层未处理GetSignAndToken action方式,再次调用原接口获取令牌;
- 2.若提示AuthClientCtrl未定义JsonActionCmdDeal方法,则直接使用GetSignAndToken方法*/
- if(resp['ret'] == -2003)
- {
- AuthClientCtrl.GetSignAndToken(randomnum);
- resp['ret'] = AuthClientCtrl.lResult == 0 ? 1 : 0;
- resp['errinfo'] = AuthClientCtrl.bstrError;
- resp['signandtoken'] = AuthClientCtrl.bstrSignValAndToken;
- }
- notify_web(resp);
- }, 0);
- }
-
- oneNetHelper_activex.GetUserCertInfo = function (notify_web)
- {
- setTimeout(function (){
- var resp = {};
- AuthClientCtrl.GetUserCertInfo();
- resp['ret'] = AuthClientCtrl.lResult == 0 ? 1 : 0;
- resp['errinfo'] = AuthClientCtrl.bstrError;
- resp['DNStringAll'] = AuthClientCtrl.bstrUserCertInfoValue('DNStringAll');
- resp['UserName'] = AuthClientCtrl.bstrUserCertInfoValue('UserName');
- resp['UserID'] = AuthClientCtrl.bstrUserCertInfoValue('UserID');
- resp['DNCode'] = AuthClientCtrl.bstrUserCertInfoValue('DNCode');
- resp['DisName'] = AuthClientCtrl.bstrUserCertInfoValue('DisName');
- resp['UniqueId'] = AuthClientCtrl.bstrUserCertInfoValue('UniqueId');
- resp['IssuerDisName'] = AuthClientCtrl.bstrUserCertInfoValue('IssuerDisName');
- resp['CertSerial'] = AuthClientCtrl.bstrUserCertInfoValue('CertSerial');
- resp['EMail'] = AuthClientCtrl.bstrUserCertInfoValue('EMail');
- resp['Org'] = AuthClientCtrl.bstrUserCertInfoValue('Org');
- resp['OrgUnit'] = AuthClientCtrl.bstrUserCertInfoValue('OrgUnit');
- resp['City'] = AuthClientCtrl.bstrUserCertInfoValue('City');
- resp['State'] = AuthClientCtrl.bstrUserCertInfoValue('State');
- resp['Descption'] = AuthClientCtrl.bstrUserCertInfoValue('Descption');
- resp['Version'] = AuthClientCtrl.bstrUserCertInfoValue('Version');
- resp['BeginTime'] = AuthClientCtrl.bstrUserCertInfoValue('BeginTime');
- resp['EndTime'] = AuthClientCtrl.bstrUserCertInfoValue('EndTime');
- //resp['authresult'] = AuthClientCtrl.lAuthResult;
- notify_web(resp);
- }, 0);
- }
- oneNetHelper_activex.Login = function (appToken,username,userpwd,authtype,svctype, gw_id, notify_web)
- {
- alert("Login IE插件未实现");
- }
- oneNetHelper_activex.ChangeUKeyPin = function (old_key_pin,new_key_pin,notify_web)
- {
- alert("ChangeUKeyPin IE插件未实现");
- }
- oneNetHelper_activex.SSLUsbKeyLogin = function (appToken,gw_id,key_pin,notify_web)
- {
- alert("SSLUsbKeyLogin IE插件未实现");
- }
-
- oneNetHelper_activex.SSLUserPwdLogin = function (appToken,gw_id,username,userpwd,notify_web)
- {
- alert("SSLUserPwdLogin IE插件未实现");
- }
-
- oneNetHelper_activex.IPSecUsbKeyLogin = function (appToken,gw_id,key_pin,notify_web)
- {
- alert("IPSecUsbKeyLogin IE插件未实现");
- }
-
- oneNetHelper_activex.Logout = function (appToken,notify_web)
- {
- alert("Logout IE插件未实现");
- }
-
- oneNetHelper_activex.QuerySecPortalStatus = function (appToken,notify_web)
- {
- alert("QuerySecPortalStatus IE插件未实现");
- }
-
- oneNetHelper_activex.HeartBeat = function (appToken,notify_web)
- {
- alert("HeartBeat IE插件未实现");
- }
-
- oneNetHelper_activex.GetGateWayAddrList = function (notify_web)
- {
- setTimeout(function (){
- var msg = InitCmdMsg("GetGateWayAddrList", "");
- var resp = {};
- AuthClientCtrl.JsonActionCmdDeal(JSON.stringify(msg));
- var obj = JSON.parse(AuthClientCtrl.bstrResponse);
- resp = obj.info;
- notify_web(resp);
- }, 0);
- }
- oneNetHelper_activex.JsonActionTestCmdDeal = function (notify_web)
- {
- setTimeout(function (){
- var msg = InitCmdMsg("testAction", "");
- var resp = {};
- AuthClientCtrl.JsonActionCmdDeal(JSON.stringify(msg));
- var obj = JSON.parse(AuthClientCtrl.bstrResponse);
- resp = obj.info;
- notify_web(resp);
- }, 0);
- }
|