public CustomPrincipal ConstructCustomPrincipal(IIdentity identity, CachedUserInfo userInfo)
 {
     if (userInfo == null)
         return null;
     var ci = new CustomIdentity(userInfo.Username, identity.IsAuthenticated, identity.AuthenticationType);
     switch (userInfo.UserType)
     {
         case UserType.Admin:
             ci.Roles.Add("Admin");
             ci.Roles.Add("User");
             break;
         case UserType.User:
             ci.Roles.Add("User");
             break;
     }
     return new CustomPrincipal(ci, userInfo);
 }
Beispiel #2
0
 public CustomPrincipal(CustomIdentity cidIdentity, CachedUserInfo userInfo)
 {
     _cidIdentity = cidIdentity;
     UserInfo = userInfo;
 }