예제 #1
0
        public void TestCreateLogin()
        {
            GateKeeperProvider currentProvider = (GateKeeperProvider)Membership.Provider;

            HarperACL.Authenticator     auth;
            SupportClasses.BaseResponse baseResponse;
            string sfgid = HarperCRYPTO.Cryptography.Hash("81060800005", true);
            string zip   = "76102";
            string un    = "mswynne";
            string pw    = HarperCRYPTO.Cryptography.Hash("mswynne1", true);

            //string un = "rcalvert";
            //string pw = "rcalvert2011";
            //10000014618
            //10000001683
            //10000000772
            //80091600006
            //10001264756

            SecureServices.SecureServices client    = new Tests.SecureServices.SecureServices();
            SecureServices.BaseResponse   bresponse = client.CreateUser(sfgid, un, pw, zip);
            if (bresponse.TypedResponse != null &&
                bresponse.TypedResponse.Success &&
                (bresponse.TypedResponse as SecureServices.LoginResponse).Authenticated)
            {
                Assert.AreEqual(true, true);
            }
        }
예제 #2
0
        public void TestLogin()
        {
            GateKeeperProvider currentProvider = (GateKeeperProvider)Membership.Provider;
            string             u;
            string             p;

            HarperACL.Authenticator     auth;
            SupportClasses.BaseResponse baseResponse;
            //u = "ut91";

            //u = "*****@*****.**";
            //p = "gilman10";
            //u = "premier1";
            //p = "@ndrew11";
            //u = "*****@*****.**";
            //p = "ledwards2011";
            //u = "mcoupland";
            //p = "testing123";
            //u = "testuser0001";
            //p = "testuser0001";
            //u = "aklein";
            //p = "aklein2011";
            //u = "kdicker";
            //p = "testing123";
            //u = "trademarkmedia";
            //p = "4eFr2cHE";
            //u = "cms_jmoon";
            //p = "andrewharper10";
            //u = "janebooz";
            //p = "october";
            //u = "*****@*****.**";
            //p = "marchbanks";
            //u = "*****@*****.**";            //p = "testing123";
            u            = "mcoupland";
            p            = "img";
            p            = HarperCRYPTO.Cryptography.Hash(p, true);
            auth         = new HarperACL.Authenticator(u, p, true, true, false);
            baseResponse = auth.Login();

            SecureServices.SecureServices client    = new Tests.SecureServices.SecureServices();
            SecureServices.BaseResponse   bresponse = client.Login(u, p, string.Empty, string.Empty);
            if (bresponse.TypedResponse != null &&
                bresponse.TypedResponse.Success &&
                (bresponse.TypedResponse as SecureServices.LoginResponse).Authenticated)
            {
                Assert.AreEqual(true, true);
            }
        }
예제 #3
0
        public void TestAllLogins()
        {
            int good = 0;
            int bad  = 0;
            GateKeeperProvider currentProvider = (GateKeeperProvider)Membership.Provider;
            string             u;
            string             p;

            HarperACL.Authenticator     auth;
            SupportClasses.BaseResponse baseResponse;
            List <HarperACL.Customer>   customers;

            using (HarperACL.ACLDataDataContext context = new HarperACL.ACLDataDataContext(ConfigurationManager.ConnectionStrings["AHT_MainConnectionString"].ConnectionString))
            {
                customers = (from a in context.Customers
                             join b in context.NetMemberships
                             on a.cusID equals b.cusID
                             where a.cusUserName != null &&
                             b.nmbDateEnd >= DateTime.Now &&
                             a.cusFirstName == "" &&
                             a.cusLastName == ""
                             select a).ToList();
            }
            foreach (HarperACL.Customer customer in customers)
            {
                u            = customer.cusUserName;
                p            = currentProvider.GetPassword(u, "");
                p            = HarperCRYPTO.Cryptography.EncryptData(p);
                auth         = new HarperACL.Authenticator(u, p, false, false, false);
                baseResponse = auth.Login();
                if (baseResponse.TypedResponse != null &&
                    baseResponse.TypedResponse.Success &&
                    (baseResponse.TypedResponse as SupportClasses.LoginResponse).Authenticated)
                {
                    good++;
                }
                else
                {
                    bad++;
                }
                System.Threading.Thread.Sleep(10);
            }
            Assert.AreEqual(true, true);
        }
예제 #4
0
        public void BulkEncrypt()
        {
            GateKeeperProvider        currentProvider = (GateKeeperProvider)Membership.Provider;
            string                    u;
            string                    p;
            List <HarperACL.Customer> customers;

            using (HarperACL.ACLDataDataContext context = new HarperACL.ACLDataDataContext(ConfigurationManager.ConnectionStrings["AHT_MainConnectionString"].ConnectionString))
            {
                customers = (from a in context.Customers
                             join b in context.NetMemberships
                             on a.cusID equals b.cusID
                             where  (a.cusEncryptedPassword == null || a.cusEncryptedPassword == "") &&
                             b.nmbDateEnd >= DateTime.Now &&
                             a.cusDateUpdated < DateTime.Now.AddDays(-2)
                             select a).ToList();

                foreach (HarperACL.Customer customer in customers)
                {
                    if (!string.IsNullOrEmpty(customer.cusUserName))
                    {
                        string z = currentProvider.GetPassword(customer.cusUserName, "");
                        if (!string.IsNullOrEmpty(z))
                        {
                            string enc = HarperCRYPTO.Cryptography.EncryptData(z);
                            if (!string.IsNullOrEmpty(enc))
                            {
                                customer.cusEncryptedPassword = enc;
                                customer.cusDateUpdated       = DateTime.Now;
                            }
                        }
                    }
                }
                context.SubmitChanges();
            }
            Assert.AreEqual(true, true);
        }