Beispiel #1
0
 public SecuritySessionDto CreateSession(AccountDto account, string appDomainId)
 {
     try
     {
         if (account != null)
         {
             int appId = 0;
             int.TryParse(appDomainId, out appId);
             SecuritySessionDto sessionDto = new SecuritySessionDto()
             {
                 AccountId         = account.AccountId,
                 AppDomainId       = appId,
                 CreateDate        = DateTime.Now,
                 SecuritySessionId = SessionIdGenerator.GenrateNewSessionId(),
             };
             this.Insert(sessionDto);
             return(sessionDto);
         }
         return(null);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Beispiel #2
0
        public void TestSessionId()
        {
            var sessionId = SessionIdGenerator.GenrateNewSessionId();
            var bytes     = SessionIdGenerator.GetByteSessionId(sessionId);
            var strs      = SessionIdGenerator.GetStringSessionId(bytes);
            var rebyte    = SessionIdGenerator.GetByteSessionId(strs);

            Assert.AreEqual(sessionId, strs);
            Assert.AreEqual(bytes.ToString(), rebyte.ToString());
        }