/// <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; }
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)) } ); }
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; }