Exemplo n.º 1
0
        /// <summary>
        ///  Creates a new instance of the <see cref="UserToken"/> instance
        ///  for a specific user, action and expiry date.
        /// </summary>
        /// <param name="user"></param>
        /// <param name="action"></param>
        /// <param name="expires"></param>

        public UserToken(User user, string action, DateTime expires)
        {
            this.Token = Guid.NewGuid();
            this.User = user;
            this.Action = action;
            this.Expires = expires;
        }
Exemplo n.º 2
0
 public void DeleteOtherSessionsForUser(string sessionID, User user)
 {
     this.Session.Delete(
         "from UserSession where SessionID != ? and User = ?",
         new object[] { sessionID, user },
         new IType[] { NHibernateUtil.String, NHibernateUtil.Entity(typeof(User)) }
     );
 }
Exemplo n.º 3
0
 public UserSession(User user, UserAgent userAgent, DateTime date) : this()
 {
     byte[] sid = new byte[24];
     var rng = new RNGCryptoServiceProvider();
     rng.GetBytes(sid);
     this.SessionID = Convert.ToBase64String(sid);
     this.User = user;
     this.UserAgent = userAgent;
     this.DateCreated = date;
     this.DateLastAccessed = date;
 }