Beispiel #1
0
 public Identity(User user)
 {
     this.user = user;
 }
Beispiel #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="WebSystemContext"/> class.
 /// </summary>
 public WebSystemContext()
 {
     Principal = new Principal(user = LoadUser());
 }
Beispiel #3
0
        private void SaveUser(User user)
        {
            var context = GetContext();

            if (user != null)
            {
                var key = Guid.NewGuid().ToString();

                context.Response.Cookies.Add(new HttpCookie(SESSION_KEY, key));
                context.Cache.Add(
                    key,
                    user,
                    null,
                    Cache.NoAbsoluteExpiration,
                    Cache.NoSlidingExpiration,
                    CacheItemPriority.NotRemovable,
                    null);
            }
            else
            {
                var cookie = context.Request.Cookies[SESSION_KEY];
                if (cookie != null)
                {
                    context.Cache.Remove(cookie.Value);
                }
            }
        }
Beispiel #4
0
 public Principal(User user)
 {
     identity = new Identity(user);
 }