コード例 #1
0
        public bool LogIn(String paLogInName, String paPassword)
        {
            Dictionary <String, String> lcSecurityInfo;

            if (clUserManager.LogIn(paLogInName, paPassword))
            {
                lcSecurityInfo = new Dictionary <String, String>();

                lcSecurityInfo.Add(ctSubscriptionID, ApplicationFrame.GetInstance().ActiveSubscription.ActiveRow.SubscriptionID);
                lcSecurityInfo.Add(ctClientIP, ApplicationFrame.GetRemoteIPAddress());
                lcSecurityInfo.Add(ctSessionStartTime, DateTime.Now.Ticks.ToString());
                CreateSession(RijdaelEncryption.GetInstance().EncryptString(General.JSONSerialize(lcSecurityInfo)));

                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #2
0
        private bool VerifySessionKey()
        {
            String lcSessionSeurityData;

            Dictionary <String, String> lcSecurityInfo;

            if ((!String.IsNullOrWhiteSpace(clSmartSectionID)) && ((lcSessionSeurityData = RijdaelEncryption.GetInstance().DecryptString(clSmartSectionID)) != null))
            {
                try { lcSecurityInfo = General.JSONDeserialize <Dictionary <String, String> >(lcSessionSeurityData); }
                catch { lcSecurityInfo = null; }

                if (lcSecurityInfo != null)
                {
                    if ((lcSecurityInfo[ctSubscriptionID] == ApplicationFrame.GetInstance().ActiveSubscription.ActiveRow.SubscriptionID))
                    {
                        return(true);
                    }
                }
            }
            return(false);
        }