private bool Login(string EMAIL, string ACCESS_NUMBER, string AUTO_LOGIN_ACCESS_NUMBER, bool AUTO_LOGIN) { Service.IResponse result; ISecureHashAlgorithm secureHashAlgorithm; string LoginType; string LDAPUrl; string Domain; try { secureHashAlgorithm = ((ISecureHashAlgorithm)this.Core.CreateInstance("SecureHashAlgorithm")); if (Config.Client.GetAttribute("Sessionkey") != null) { AUTO_LOGIN = true; AUTO_LOGIN_ACCESS_NUMBER = secureHashAlgorithm.ComputeHashToBase64String(this.Core.GetAttribute("Guid")); } else { LoginType = this.Core.GetAttribute("LoginType"); LDAPUrl = this.Core.GetAttribute("LDAPUrl"); Domain = this.Core.GetAttribute("Domain"); if (!LoginType.IsNullOrWhiteSpace() && LoginType == "LDAP" && !LDAPUrl.IsNullOrWhiteSpace()) { try { this.LDAPQuery(LDAPUrl, Domain, EMAIL, ACCESS_NUMBER); AUTO_LOGIN = true; AUTO_LOGIN_ACCESS_NUMBER = secureHashAlgorithm.ComputeHashToBase64String(this.Core.GetAttribute("Guid")); } catch (Exception ex) { this.WindowsMessageBoxShow(Application.Current.Windows[0], ex); return(false); } } } //자동 로그인 이고 저장된 패스워드가 없으면 현재 입력한 패스워드를 암호화 //저장된 패스워드가 있으면 패스워드는 암호화되어 있기 때문에 그냥 패스 if (AUTO_LOGIN && (AUTO_LOGIN_ACCESS_NUMBER == null || AUTO_LOGIN_ACCESS_NUMBER == "")) { AUTO_LOGIN_ACCESS_NUMBER = secureHashAlgorithm.ComputeHashToBase64String(ACCESS_NUMBER); } result = this.Core.Search(new DefaultLoginSearchModel() { EMAIL = EMAIL, ACCESS_NUMBER = (AUTO_LOGIN) ? AUTO_LOGIN_ACCESS_NUMBER : secureHashAlgorithm.ComputeHashToBase64String(ACCESS_NUMBER)//자동 로그인이 아니면 패스워드 암호화해서 전송 }); if (result.Status == Service.Status.OK) { if (result.DataSet != null && result.DataSet.Tables.Count >= 1) { foreach (DataTable _DataTable in result.DataSet.Tables) { for (int i = 1; i < _DataTable.Columns.Count; i++) { foreach (DataRow _DataRow in _DataTable.Rows) { Config.Client.SetAttribute(string.Format("{0}.{1}", _DataRow[0].ToString(), _DataTable.Columns[i].ColumnName), _DataRow[i]); } } } } if (AUTO_LOGIN) { Properties.Settings.Default.Password = AUTO_LOGIN_ACCESS_NUMBER; Properties.Settings.Default.Save(); } return(true); } else { this.WindowsMessageBoxShow(Application.Current.Windows[0], result.Message, "Warning", MessageBoxButton.OK, MessageBoxImage.Warning); return(false); } } catch (Exception ex) { this.WindowsMessageBoxShow(Application.Current.Windows[0], ex); } return(false); }