コード例 #1
0
        public void CanCall_IMSWebService_Success()
        {
            try
            {
                var imsService = new com.personifycloud.smemitst1.IMService();

                //currently just two roles: COMMITTEE_MEMBER & MEMBER
                var allRolesResult = imsService.IMSVendorRolesGet(PersonifyVendorName, PersonifyVendorPassword);

                foreach (var roleResult in allRolesResult.VendorRoles)
                {
                    var customers = imsService.IMSRoleCustomersGet(PersonifyVendorName, PersonifyVendorPassword, roleResult.RoleId);
                }

                //one web-role, deactivated with no role description
                var allWebRolesResult = imsService.IMSVendorWebRolesGet(PersonifyVendorName, PersonifyVendorPassword);

                foreach (var roleResult in allWebRolesResult.VendorRoles)
                {
                    var customers = imsService.IMSRoleCustomersGet(PersonifyVendorName, PersonifyVendorPassword, roleResult.RoleId);
                }

                var results  = imsService.IMSCustomerRoleGetByTimssCustomerId(PersonifyVendorName, PersonifyVendorPassword, "02991320|0");
                var results2 = imsService.IMSCustomerWebRoleGet(PersonifyVendorName, PersonifyVendorPassword, "02991320|0");
            }
            catch (Exception ex)
            {
                System.Console.WriteLine(ex.ToString());
            }
        }
コード例 #2
0
        public void Stuff3()
        {
            Uri serviceUri = new Uri(svcUri_Base);

            var service = new PersonifyData.PersonifyEntitiesBase(serviceUri);

            service.IgnoreMissingProperties = true;
            service.Credentials             = new System.Net.NetworkCredential(svcLogin, svcPassword);
            var stuff = service.CustomerInfos.Where(x => x.LastName == "Hoiberg").ToList();

            var firstOne = stuff.FirstOrDefault();

            var ssoservice = new com.personifycloud.smemitst.service();

            var personifyIdentifier = firstOne.MasterCustomerId + "|0";

            var customer = ssoservice.SSOCustomerGet(PersonifyVendorName, PersonifyVendorPassword, personifyIdentifier);

            var imsService = new com.personifycloud.smemitst1.IMService();

            var webRoles = imsService.IMSCustomerWebRoleGet(PersonifyVendorName, PersonifyVendorPassword, personifyIdentifier);

            var otherRoles = imsService.IMSCustomerRoleGet(PersonifyVendorName, PersonifyVendorPassword, personifyIdentifier);


            Assert.IsTrue(true);
        }
コード例 #3
0
ファイル: SSOTests.cs プロジェクト: SMEWebmaster/Kentico16
        public void SSOWebServiceTestHarness2()
        {
            try
            {
                var username = "******";
                var password = "******";

                var service = new com.personifycloud.smemitst.service();

                var vendorToken = RijndaelAlgorithm.GetVendorToken("http://testpage.com/", PersonifyVendorPassword, PersonifyVendorBlock, username, password, true);

                var url = string.Format("{0}?vi={1}&vt={2}", PersonifyAutoLoginUrl, PersonifyVendorID, vendorToken);

                System.Net.HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
                request.AutomaticDecompression = DecompressionMethods.GZip;
                var html = string.Empty;

                var querystringDictionary = new Dictionary <string, string>();
                using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
                    using (Stream stream = response.GetResponseStream())
                        using (StreamReader reader = new StreamReader(stream))
                        {
                            html = reader.ReadToEnd();
                            var queryString = response.ResponseUri.Query;

                            if (queryString.StartsWith("?"))
                            {
                                queryString = queryString.Substring(1);

                                foreach (var pair in queryString.Split(new char[] { '&' }))
                                {
                                    var items = pair.Split(new char[] { '=' });

                                    if (items != null && items.Length == 2)
                                    {
                                        querystringDictionary.Add(items.First(), items.Last());
                                    }
                                }
                            }
                        }

                if (querystringDictionary.ContainsKey("ct"))
                {
                    var encryptedCT = querystringDictionary["ct"];

                    var r = service.CustomerTokenDecrypt(PersonifyVendorName, PersonifyVendorPassword, PersonifyVendorBlock, encryptedCT);

                    ///this should decrypt into a guid looking thing.  Sometimes the webservice returns a corrupt string.  When that happens, should we just retry?
                    var customerToken = r.CustomerToken;

                    var tokenIsValidResult = service.SSOCustomerTokenIsValid(PersonifyVendorName, PersonifyVendorPassword, customerToken);

                    if (tokenIsValidResult.Valid)
                    {
                        customerToken = tokenIsValidResult.NewCustomerToken;

                        var result = service.SSOCustomerGetByCustomerToken(PersonifyVendorName, PersonifyVendorPassword, customerToken);

                        if (result != null && result.UserExists)
                        {
                            var userExists = result.UserExists;
                            var userName   = result.UserName;
                            var email      = result.Email;
                            var flag       = result.DisableAccountFlag;

                            //for giggles
                            var ciResult = service.TIMSSCustomerIdentifierGet(PersonifyVendorName, PersonifyVendorPassword, customerToken);

                            if (ciResult == null || String.IsNullOrEmpty(ciResult.CustomerIdentifier))
                            {
                                var identifier = "0517438|0";

                                var identifierSetResult = service.TIMSSCustomerIdentifierSet(PersonifyVendorName, PersonifyVendorPassword, userName, identifier);

                                if (identifierSetResult.CustomerIdentifier == identifier)
                                {
                                    System.Console.WriteLine(identifierSetResult.CustomerIdentifier);
                                }
                            }
                            var imsService = new com.personifycloud.smemitst1.IMService();

                            var allRolesResult = imsService.IMSVendorRolesGet(PersonifyVendorName, PersonifyVendorPassword);

                            var groupResult = imsService.IMSCustomerRoleGet(PersonifyVendorName, PersonifyVendorPassword, customerToken);

                            if (groupResult != null && groupResult.CustomerRoles != null)
                            {
                                foreach (var customerRole in groupResult.CustomerRoles)
                                {
                                    if (customerRole != null && !String.IsNullOrEmpty(customerRole.Value))
                                    {
                                        var aRole = customerRole.Value;
                                        aRole.Equals(aRole);
                                    }
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                System.Console.WriteLine(ex.ToString());
            }
        }