Exemplo n.º 1
0
 public Identity(User user)
 {
     this.user = user;
 }
Exemplo n.º 2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="WebSystemContext"/> class.
 /// </summary>
 public WebSystemContext()
 {
     Principal = new Principal(user = LoadUser());
 }
Exemplo n.º 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);
                }
            }
        }
Exemplo n.º 4
0
 public Principal(User user)
 {
     identity = new Identity(user);
 }