public AdminClientProxy(hc.Plat.Common.Global.ClientProxyExType cpet) { //传输当前用户的信息; ApplicationContext.Current.UserID = cpet.UserID; ApplicationContext.Current.WebIP = cpet.IP_WebServer; ApplicationContext.Current.ClientIP = cpet.IP_Client; if (cpet.CurrentUser != null) { UserView userView = cpet.CurrentUser as UserView; if (userView != null) { ApplicationContext.Current.UserName = userView.UserName; ApplicationContext.Current.CompanyId = userView.CompanyId.ToString(); ApplicationContext.Current.CompanyName = userView.CompanyName; ApplicationContext.Current.RoleType = userView.RoleType.ToString(); } } /*以下密码是用作在应用服务器中使用程序验证密码的作用*/ string FilePath = AppDomain.CurrentDomain.BaseDirectory + "bin\\"; string user = ""; string pass = ""; string msg = DesTool.LoadCertUserPass(FilePath, out user, out pass); if (msg != "") { throw new Exception(msg); } ClientCredentials.UserName.UserName = user; ClientCredentials.UserName.Password = pass; /*OK*/ }
public override void Validate(string userName, string password) { string FilePath = AppDomain.CurrentDomain.BaseDirectory; string user = ""; string pass = ""; string msg = DesTool.LoadCertUserPass(FilePath, out user, out pass); if (msg != "") { throw new System.ServiceModel.Security.SecurityNegotiationException(msg); } if (userName != user || password != pass) { throw new System.ServiceModel.Security.SecurityNegotiationException("验证用户名和密码时,未通过检测"); } }
public BusinessClientProxy(hc.Plat.Common.Global.ClientProxyExType cpet) { //传输当前用户的信息; ApplicationContext.Current.UserID = cpet.UserID; ApplicationContext.Current.WebIP = cpet.IP_WebServer; ApplicationContext.Current.ClientIP = cpet.IP_Client; /*以下密码是用作在应用服务器中使用程序验证密码的作用*/ string FilePath = AppDomain.CurrentDomain.BaseDirectory + "bin\\"; string user = ""; string pass = ""; string msg = DesTool.LoadCertUserPass(FilePath, out user, out pass); if (msg != "") { throw new Exception(msg); } ClientCredentials.UserName.UserName = user; ClientCredentials.UserName.Password = pass; /*OK*/ }