public static AuthorizationResponse GetAuthorization(string lastName, string dateOfBirth, string lastFour) { var authResponse = new AuthorizationResponse(); lastName = lastName.Replace(" ", "_"); var request = new AuthMemberDataRequest { LastName = lastName, DateOfBirth = dateOfBirth, LastFourSsn = lastFour }; string requestUrl = string.Format("v1/Animation/Membership/Register1/{0}", "AnzovinHandshakeId".GetConfigurationValue()); try { using (var client = BaseService.GetClient()) { var response = client.PostAsJsonAsync(requestUrl, request).Result; if (response.IsSuccessStatusCode) { authResponse = response.Content.ReadAsAsync <AuthorizationResponse>().Result; } } } catch (Exception exc) { HelperService.LogAnonEvent(ExperienceEvents.Error, exc.InnerException == null ? exc.Message : exc.InnerException.InnerException == null ? exc.InnerException.Message : exc.InnerException.InnerException.Message); } return(authResponse); }
public HttpResponseMessage GetAuthMemberData([FromBody] AuthMemberDataRequest hsRequest) { var httpClient = new HttpClient(); string requestUri = string.Format("{0}/v1/PComm/VideoAuth/MemberData/{1}", "APIBaseAddress".GetConfigurationValue(), "HandshakeId".GetConfigurationValue()); Request.RequestUri = new Uri(requestUri); HttpResponseMessage response = httpClient.SendAsync(Request).Result; if (!response.IsSuccessStatusCode) { response = Request.CreateResponse(HttpStatusCode.Unauthorized); } return(response); }
public HttpResponseMessage GetAuthMemberData(String hsId, [FromBody] AuthMemberDataRequest hsRequest) { HttpResponseMessage hrm = Request.CreateResponse(HttpStatusCode.Unauthorized); var e = new CCHEncrypt(); if (ValidateConsumer.IsValidConsumer(hsId)) { hrm = Request.CreateErrorResponse(HttpStatusCode.NoContent, new Exception("User Not Found")); using (var gefae = new GetEnrollmentsForAllEmployers()) { gefae.LastName = hsRequest.LastName; gefae.LastFour = hsRequest.LastFourSsn; gefae.DateOfBirth = hsRequest.DateOfBirth; gefae.GetFrontEndData(); if (gefae.Tables.Count > 0 && gefae.Tables[0].Rows.Count > 0) { DataRow dr = gefae.Tables[0].Rows[0]; int cchid = dr.GetData <int>("CCHID"); string cnxString = dr.GetData("ConnectionString"); int employerId = dr.GetData <int>("employerid"); //UserAccess Check dstrickland 7/7/2015 using (var cpaa = new CheckPersonApplicationAccess(cchid, cnxString)) { if (!cpaa.HasAccess) { return(Request.CreateErrorResponse(HttpStatusCode.Unauthorized, new Exception(cpaa.ErrorMessage))); } } e.UserKey = Request.EncryptionKey(); e.SecretKey = Properties.Settings.Default.SecretKey; e.Add("CCHID", cchid.ToString(CultureInfo.InvariantCulture)); e.Add("EmployerID", employerId.ToString(CultureInfo.InvariantCulture)); string authHash = e.ToString(); if (employerId > 0) { CreateLoginAudit(hsId, Request.RequestUri.Host.ToString(CultureInfo.InvariantCulture), cchid, cnxString); hrm = Request.CreateErrorResponse(HttpStatusCode.NoContent, new Exception("Video Data Not Found")); using (var gvcmi = new GetVideoCampaignMemberIdByCchId()) { gvcmi.CampaignId = hsRequest.CampaignId; gvcmi.CchId = cchid; gvcmi.GetData(cnxString); if (!gvcmi.HasThrownError && !string.IsNullOrEmpty(gvcmi.VideoCampaignMemberId)) { using (var gvcmd = new GetVideoCampaignMemberDataById()) { gvcmd.VideoCampaignMemberId = gvcmi.VideoCampaignMemberId; gvcmd.GetData(cnxString); if (!gvcmd.HasThrownError) { string videoMemberData = gvcmd.VideoMemberData; string resultset = string.Format("\"AuthHash\":\"{0}\",\"MemberData\":{1}", authHash, videoMemberData); resultset = string.Concat("{", resultset, "}"); hrm = new HttpResponseMessage(HttpStatusCode.OK) { RequestMessage = Request, Content = new StringContent(resultset), StatusCode = HttpStatusCode.OK }; } } } } } } } } return(hrm); }