public ResponseModel authenticateUser() { string X_Authorized_Programcode = Convert.ToString(Request.Headers["X-Authorized-Programcode"]); string X_Authorized_userId = Convert.ToString(Request.Headers["X-Authorized-userId"]); string X_Authorized_password = Convert.ToString(Request.Headers["X-Authorized-password"]); string X_Authorized_Domainname = Convert.ToString(Request.Headers["X-Authorized-Domainname"]); ResponseModel resp = new ResponseModel(); try { securityCaller newSecurityCaller = new securityCaller(); AccountModal account = new AccountModal(); string programCode = X_Authorized_Programcode.Replace(' ', '+'); string domainName = X_Authorized_Domainname.Replace(' ', '+'); string userId = X_Authorized_userId.Replace(' ', '+'); string password = X_Authorized_password.Replace(' ', '+'); if (!string.IsNullOrEmpty(programCode) && !string.IsNullOrEmpty(domainName) && !string.IsNullOrEmpty(userId) && !string.IsNullOrEmpty(password)) { account = newSecurityCaller.validateUser(new SecurityService(Cache, Db), programCode, domainName, userId, password); if (!string.IsNullOrEmpty(account.Token)) { account.IsActive = true; resp.Status = true; resp.StatusCode = (int)EnumMaster.StatusCode.Success; resp.ResponseData = account; resp.Message = "Valid Login"; } else { account.IsActive = false; resp.Status = true; resp.StatusCode = (int)EnumMaster.StatusCode.Success; resp.ResponseData = account; resp.Message = "In-Valid Login"; } } else { resp.Status = false; resp.ResponseData = account; resp.Message = "Invalid Login"; } } catch (Exception) { throw; } return(resp); }
public ResponseModel AuthenticateUser() { string X_Authorized_Programcode = Convert.ToString(Request.Headers["X-Authorized-Programcode"]); string X_Authorized_userId = Convert.ToString(Request.Headers["X-Authorized-userId"]); string X_Authorized_password = Convert.ToString(Request.Headers["X-Authorized-password"]); string X_Authorized_Domainname = Convert.ToString(Request.Headers["X-Authorized-Domainname"]); ResponseModel resp = new ResponseModel(); try { securityCaller newSecurityCaller = new securityCaller(); AccountModal account = new AccountModal(); string Programcode = X_Authorized_Programcode.Replace(' ', '+'); string Domainname = X_Authorized_Domainname.Replace(' ', '+'); string userId = X_Authorized_userId.Replace(' ', '+'); string password = X_Authorized_password.Replace(' ', '+'); string _data = ""; if (X_Authorized_Programcode != null) { X_Authorized_Programcode = SecurityService.DecryptStringAES(X_Authorized_Programcode); RedisCacheService cacheService = new RedisCacheService(_radisCacheServerAddress); if (cacheService.Exists("Con" + X_Authorized_Programcode)) { _data = cacheService.Get("Con" + X_Authorized_Programcode); _data = JsonConvert.DeserializeObject <string>(_data); } } if (!string.IsNullOrEmpty(Programcode) && !string.IsNullOrEmpty(Domainname) && !string.IsNullOrEmpty(userId) && !string.IsNullOrEmpty(password)) { account = newSecurityCaller.validateUser(new SecurityService(_data, _radisCacheServerAddress), Programcode, Domainname, userId, password); if (!string.IsNullOrEmpty(account.Token)) { account.IsActive = true; resp.Status = true; resp.StatusCode = (int)EnumMaster.StatusCode.Success; resp.ResponseData = account; resp.Message = "Valid Login"; } else { account.IsActive = false; resp.Status = true; resp.StatusCode = (int)EnumMaster.StatusCode.Success; resp.ResponseData = account; resp.Message = "In-Valid Login"; } } else { resp.Status = false; resp.ResponseData = account; resp.Message = "Invalid Login"; } } catch (Exception) { throw; } return(resp); }