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.TDR: ci.Roles.Add("TDR"); break; } return new CustomPrincipal(ci, userInfo); }
public CustomPrincipal(CustomIdentity cidIdentity, CachedUserInfo userInfo) { _cidIdentity = cidIdentity; UserInfo = userInfo; }