public static List <Claim> BuildClaims(CurrentUserModel currentUser) { currentUser.TrimStringProps(); currentUser.Roles ??= new string[0]; var abpClaims = new List <Claim> { new Claim(AbpClaimTypes.UserId, currentUser.AccountId.ToString()), new Claim(AbpClaimTypes.EditionId, currentUser.AccountId.ToString()), new Claim(AbpClaimTypes.UserName, currentUser.LoginName), new Claim(ZenSharedConstants.OwnerIdClaim, currentUser.OwnerId.HasValue ? currentUser.OwnerId.ToString() : ""), new Claim(ZenSharedConstants.OrgIdClaim, currentUser.OrgId.HasValue ? currentUser.OrgId.ToString() : ""), new Claim(ZenSharedConstants.OrgNameClaim, currentUser.OrgName), new Claim(ZenSharedConstants.NickNameClaim, currentUser.NickName), new Claim(AbpClaimTypes.Role, string.Join(',', currentUser.Roles)), new Claim(AbpClaimTypes.Email, currentUser.Email), new Claim(AbpClaimTypes.PhoneNumber, currentUser.Phone), new Claim(ZenSharedConstants.AccessToken, currentUser.AccessToken) }; return(abpClaims); }
public static ClaimsIdentity BuildClaimsIdentity(CurrentUserModel currentUser) { var abpClaims = BuildClaims(currentUser); var result = new ClaimsIdentity(abpClaims); return(result); }