Exemplo n.º 1
0
 public static void SetLoggedUserInfo(HttpContextBase httpContext)
 {
     if (httpContext.User != null && httpContext.User.Identity.IsAuthenticated)
     {
         LoggedUserInfo info = GetUserInfoFromDB(httpContext.User.Identity.Name);
         if (info == null)
         {
             SignOutUser(httpContext);
         }
         else
         {
             httpContext.User = CreateUserPrincipal(info);
         }
     }
 }
Exemplo n.º 2
0
 public UserPrincipal(IIdentity identity, LoggedUserInfo userInfo)
     : base(identity, userInfo.Roles)
 {
     UserInfo = userInfo;
 }
Exemplo n.º 3
0
        private static UserPrincipal CreateUserPrincipal(LoggedUserInfo user)
        {
            var identity = new UserIdentity("DB", true, user.Login);

            return(new UserPrincipal(identity, user));
        }