private serviceSoap GetSsoServiceProxy() { var proxy = new serviceSoapClient("serviceSoap"); ((ICommunicationObject)proxy).Open(); return(proxy); }
protected async void SignOut() { serviceSoapClient client = null; try { string ctoken = HttpContext.Session.GetString("MyToken"); string SSOVendorUsername = Configuration.GetSection("MyConfiguration").GetSection("SSO").GetSection("SSOVendorUsername").Value; // "TIMSS"; string SSOVendorPassword = Configuration.GetSection("MyConfiguration").GetSection("SSO").GetSection("SSOVendorPassword").Value; // "A0468692C8563BF06ADED9F85BBE3F5D"; string SSOWebService_service = Configuration.GetSection("MyConfiguration").GetSection("SSO").GetSection("SSOWebService_service").Value; // "https://login75.acr.org/webservice/service.asmx"; var basicHttpBinding = new BasicHttpsBinding(BasicHttpsSecurityMode.Transport); basicHttpBinding.Security.Transport.ClientCredentialType = HttpClientCredentialType.None; var endpointAddress = new EndpointAddress(new Uri(SSOWebService_service)); client = new serviceSoapClient(basicHttpBinding, endpointAddress); if (client.State == System.ServiceModel.CommunicationState.Faulted) { client.Abort(); client = new serviceSoapClient(basicHttpBinding, endpointAddress); } var decCt = await client.SSOCustomerLogoutAsync(SSOVendorUsername, SSOVendorPassword, ctoken).ConfigureAwait(false); client.Abort(); } catch (Exception ex) { string error = ex.Message; _logger.LogError(ex, error); if (client != null) { client.Abort(); } } }
//private Boolean IsUserMemberOfGroup(SPGroup oGroup, SPUser user) //{ // Boolean userIsInGroup = false; // foreach (SPUser item in oGroup.Users) // { // if (item.UserToken.CompareUser(user.UserToken)) // { // userIsInGroup = true; // break; // } // } // return userIsInGroup; //} //private bool IsMobileBrowser() //{ // ////GETS THE CURRENT USER CONTEXT // HttpContext context = HttpContext.Current; // if (context.Request.ServerVariables["HTTP_USER_AGENT"] != null) // { // string[] mobiles = System.Configuration.ConfigurationManager.AppSettings["Mobile_Browsers"].Split(';'); // //Loop through each item in the list created above // //and check if the header contains that text // foreach (string s in mobiles) // { // if (context.Request.ServerVariables["HTTP_USER_AGENT"].ToLower().Contains(s.ToLower())) // { // return true; // } // } // } // return false; //} public async Task <ActionResult> OnGetAsync(string ct, string returnUrl) { serviceSoapClient client = null; string SSOWebService_service = Configuration.GetSection("MyConfiguration").GetSection("SSO").GetSection("SSOWebService_service").Value; // "https://login75.acr.org/webservice/service.asmx"; string SSOLoginUrl = Configuration.GetSection("MyConfiguration").GetSection("SSO").GetSection("SSOLoginUrl").Value; // "https://login75.acr.org/Login.aspx"; string SSOVendorIdentifier = Configuration.GetSection("MyConfiguration").GetSection("SSO").GetSection("SSOVendorIdentifier").Value; // "2"; string SSOVendorUsername = Configuration.GetSection("MyConfiguration").GetSection("SSO").GetSection("SSOVendorUsername").Value; // "TIMSS"; string SSOVendorPassword = Configuration.GetSection("MyConfiguration").GetSection("SSO").GetSection("SSOVendorPassword").Value; // "A0468692C8563BF06ADED9F85BBE3F5D"; string SSOVendorBlock = Configuration.GetSection("MyConfiguration").GetSection("SSO").GetSection("SSOVendorBlock").Value; // "3AD654E5CF0CCBECB96A35049FD529C6"; Utility.PIWSAcc_Login = Configuration.GetSection("MyConfiguration").GetSection("SSO").GetSection("PIWSAcc_Login").Value; // "airpapplication"; Utility.PIWSAcc_Password = Configuration.GetSection("MyConfiguration").GetSection("SSO").GetSection("PIWSAcc_Password").Value; // "*AiRPmor1!"; Utility.Pws_Acc_OrgId = Configuration.GetSection("MyConfiguration").GetSection("SSO").GetSection("Pws_Acc_OrgId").Value; // "acr"; Utility.Pws_Acc_OrgUnitId = Configuration.GetSection("MyConfiguration").GetSection("SSO").GetSection("Pws_Acc_OrgUnitId").Value; // "acr"; Utility.PersonifySSOWebService_Default = Configuration.GetSection("MyConfiguration").GetSection("SSO").GetSection("PersonifySSOWebService_Default").Value; // "https://personifyws75.acr.org/SimpleWebService/Default.asmx"; try { bool acriCookie = Request.Cookies["ACRICookie"] != null ? true : false; if (ct == null) { string _connType = "http"; if (Request.IsHttps) { _connType = "https"; } returnUrl = string.Empty; string ssoURL = string.Empty; string rURL = String.Format("{0}|{1}://{2}{3}", GetTimeStamp(), _connType, Request.Headers["HOST"], returnUrl); var basicHttpBinding = new BasicHttpsBinding(BasicHttpsSecurityMode.Transport); basicHttpBinding.Security.Transport.ClientCredentialType = HttpClientCredentialType.None; var endpointAddress = new EndpointAddress(new Uri(SSOWebService_service)); client = new serviceSoapClient(basicHttpBinding, endpointAddress); if (client.State == System.ServiceModel.CommunicationState.Faulted) { client.Abort(); client = new serviceSoapClient(basicHttpBinding, endpointAddress); } var vt = await client.VendorTokenEncryptAsync(SSOVendorUsername, SSOVendorPassword, SSOVendorBlock, rURL).ConfigureAwait(false); if (acriCookie) { ssoURL = String.Format( "{0}?vi={1}&vt={2}&DPLF=Y", SSOLoginUrl, SSOVendorIdentifier, vt.VendorToken); } else { ssoURL = String.Format( "{0}?vi={1}&vt={2}", SSOLoginUrl, SSOVendorIdentifier, vt.VendorToken); } client.Abort(); client = null; return(Redirect(ssoURL)); } else { var basicHttpBinding = new BasicHttpsBinding(BasicHttpsSecurityMode.Transport); basicHttpBinding.Security.Transport.ClientCredentialType = HttpClientCredentialType.None; var endpointAddress = new EndpointAddress(new Uri(SSOWebService_service)); client = new serviceSoapClient(basicHttpBinding, endpointAddress); if (client.State == System.ServiceModel.CommunicationState.Faulted) { client.Abort(); client = new serviceSoapClient(basicHttpBinding, endpointAddress); } string encCusToken = ct; var decCt = await client.CustomerTokenDecryptAsync(SSOVendorUsername, SSOVendorPassword, SSOVendorBlock, encCusToken).ConfigureAwait(false); //HttpContext.Session.SetString("MyToken", decCt.CustomerToken); var validCT = await client.SSOCustomerTokenIsValidAsync(SSOVendorUsername, SSOVendorPassword, decCt.CustomerToken).ConfigureAwait(false); var customerToken = validCT.NewCustomerToken; HttpContext.Session.SetString("MyToken", customerToken); var fullCustomerIdentifier = await client.TIMSSCustomerIdentifierGetAsync(SSOVendorUsername, SSOVendorPassword, customerToken).ConfigureAwait(false); string customerId = fullCustomerIdentifier.CustomerIdentifier; string masterCustomerId = customerId.Remove(customerId.IndexOfAny(new char[] { '|' }));; client.Abort(); client = null; String myparamList = "@master_customer_id"; String myspName = "ACR_GET_STATE_CHAPTER_PORTAL_SP"; String myparamValueList = ""; myparamValueList = masterCustomerId; HttpContext.Session.SetString("MyMemberId", masterCustomerId); try { DataSet myDS = await Utility.AMS_Query_Result(myspName, myparamList, myparamValueList).ConfigureAwait(false); if (myDS.Tables.Count > 0) { foreach (DataTable tbl in myDS.Tables) { if (tbl.TableName == "Table") { if (tbl.Rows.Count > 0) { string pos = myDS.Tables[0].Rows[0]["CHAPTER_PORTAL_ADMIN_POSITION"] as string; string chapterId = myDS.Tables[0].Rows[0]["CHAPTER_CUSTOMER_ID"] as string; string[] positions = pos.Split(','); int ii = positions.Length; string chptPosition = string.Empty; if (ii > 0) { foreach (string p in positions) { if (p == "CHAPTER_PORTAL_ADMIN") { chptPosition = p; break; } } if (string.IsNullOrEmpty(chptPosition)) { foreach (string p in positions) { if (p == "STAFF") { chptPosition = p; break; } } } } int i = 0; int multipleChap = 0; string chapterName = string.Empty; while (i < myDS.Tables[0].Rows.Count) { chptPosition = VerifyUserAccess(myDS.Tables[0].Rows[i]["CHAPTER_CUSTOMER_ID"] as string, myDS.Tables[0].Rows[i]["IS_ACTIVE_OFFICER_ON_STATE_CHAPTER"] as string, myDS.Tables[0].Rows[i]["IS_CSC_LIASON"] as string, myDS.Tables[0].Rows[i]["IS_ACTIVE_MEMBER_ON_COMMITTEE_OF_CHAPTERS"] as string, chptPosition); if (!string.IsNullOrEmpty(chptPosition)) { chapterId = myDS.Tables[0].Rows[i]["CHAPTER_CUSTOMER_ID"] as string; chapterName = myDS.Tables[0].Rows[i]["NAME_OF_CHAPTER"] as string; multipleChap++; } i++; } if (string.IsNullOrEmpty(chptPosition) && masterCustomerId == "05054397") { chptPosition = "CHAPTER_PORTAL_ADMIN"; chapterName = "Virginia Chapter of the ACR"; //HttpContext.Session.SetString("OfficerChapterId", "05040222"); } if (string.IsNullOrEmpty(chptPosition)) { return(RedirectToPage("/Error", new { Id = "Sorry that you are not allowed to log in. Please contact ACR staff for assistance." })); } HttpContext.Session.SetString("OfficerChapterId", chapterId); HttpContext.Session.SetString("OfficerChapterName", chapterName); var claims = new[] { new Claim(ClaimTypes.Name, masterCustomerId), new Claim(ClaimTypes.Role, chptPosition) }; var identity = new ClaimsIdentity(claims, CookieAuthenticationDefaults.AuthenticationScheme); await HttpContext.SignInAsync( CookieAuthenticationDefaults.AuthenticationScheme, new ClaimsPrincipal(identity)); string str = HttpContext.Session.GetString("MyMemberId"); if (multipleChap > 1) { HttpContext.Session.SetString("OfficerChapterId", string.Empty); return(RedirectToPage("/Chapters", new { id = masterCustomerId })); } else { return(RedirectToPage("/Landing", new { id = masterCustomerId })); } } } } } } catch (Exception ex) { string error = ex.Message; _logger.LogError(ex, error); } return(RedirectToPage("/Error", new { Id = "Sorry that you are not allowed to log in. Please contact ACR staff for assistance." })); } } catch (TimeoutException ex) { string error = ex.Message; _logger.LogError(ex, error); if (client != null) { client.Abort(); } } catch (FaultException <string> ex) { string error = ex.Message; _logger.LogError(ex, error); if (client != null) { client.Abort(); } } catch (FaultException ex) { string error = ex.Message; _logger.LogError(ex, error); if (client != null) { client.Abort(); } } catch (CommunicationException ex) { string error = ex.Message + ex.StackTrace; _logger.LogError(ex, error); if (client != null) { client.Abort(); } } catch (Exception ex) { string error = ex.Message; _logger.LogError(ex, error); if (client != null) { client.Abort(); } } return(RedirectToPage("/Error", new { Id = "You encountered some technical issues. Please contact System Administrator for assistance." })); }
public TaxService() { service = new CustomerService(); caTaxProxy = new CATaxRateAPISoapClient(); waTaxProxy = new serviceSoapClient(); }