DeviceManager/TsSFCDeviceSvc/App_Code/SFCAuthorize.cs

59 lines
1.7 KiB
C#
Raw Permalink Normal View History

2024-07-22 07:50:10 +00:00
using NLog;
using System;
using System.Text;
using System.Web;
using System.Web.Services.Protocols;
namespace TsSFCDeviceSvc.App_Code
{
public class SFCAuthorize : SoapHeader
{
private static readonly Logger log = LogManager.GetCurrentClassLogger();
public string Password;
public string Username;
public string GUID;
/// <summary>
/// SAP环境0测试环境/1正式环境
/// </summary>
public UInt16 SapSetting;
public string Version;
public string MacAddress;
public bool ValidUser(string inUsername, string inPassword)
{
//Utility.SapSetting = SapSetting;
if (inPassword == null) throw new ArgumentNullException("inPassword");
string conpass = "";
if (inUsername.Length == 0) return false;
string ip = HttpContext.Current.Request.UserHostAddress;
byte[] password = Encoding.Unicode.GetBytes(Username);
Array.Reverse(password);
string pass64 = Convert.ToBase64String(password);
if (pass64.Length < 10) pass64 += "YeT+=fue";
conpass = pass64;
if (conpass == Password)
{
return true;
}
//log.WriteLog("ValidUser", "密码验证未通过,有可能有非法用户在尝试登录:" + ip);
log.Error("ValidUser", "パスワードの検証が失敗し、ログインしようとする違法ユーザがあるかもしれません:" + ip);
return false;
}
public string token;
public SFCAuthorize()
{
2024-11-09 04:25:57 +00:00
2024-07-22 07:50:10 +00:00
}
}
}