Exemple #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);
         }
     }
 }
Exemple #2
0
 public UserPrincipal(IIdentity identity, LoggedUserInfo userInfo)
     : base(identity, userInfo.Roles)
 {
     UserInfo = userInfo;
 }
Exemple #3
0
        private static UserPrincipal CreateUserPrincipal(LoggedUserInfo user)
        {
            var identity = new UserIdentity("DB", true, user.Login);

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