private async Task <List <Claim> > CreateJwtClaims(AbpLoginResult <Tenant, User> loginResult) { var claims = loginResult.Identity.Claims.ToList(); var nameIdClaim = claims.First(c => c.Type == JwtRegisteredClaimNames.Sub); string userModel = JsonConvert.SerializeObject(Mapper.Map <UserLoginInfoDto>(loginResult.User)); var org = await UserManager.GetOrganizationUnitsAsync(loginResult.User); string orgModel = JsonConvert.SerializeObject(Mapper.Map <List <OrgLoginInfo> >(org)); var company = await CompanyManager.FindByIdAsync(loginResult.User.CompanyId); string companyModel = JsonConvert.SerializeObject(Mapper.Map <CompanyLoginInfo>(company)); var roles = await UserManager.GetRolesAsync(loginResult.User); var max_role_type = await UserRoleManager.MaxRoleType(roles); // Specifically add the jti (random nonce), iat (issued timestamp), and sub (subject/user) claims. claims.AddRange(new[] { new Claim("UserModel", userModel), new Claim("OrgModel", orgModel), new Claim("CompanyModel", companyModel), new Claim("MaxRoleType", max_role_type.ToString()), new Claim(ClaimTypes.NameIdentifier, nameIdClaim.Value), new Claim(JwtRegisteredClaimNames.Jti, Guid.NewGuid().ToString()), //new Claim(JwtRegisteredClaimNames.Iat, DateTimeOffset.Now.ToUnixTimeSeconds().ToString(), ClaimValueTypes.Integer64) }); return(claims); }