public async Task <CreateJwtTokenResult> CreateJwtTokensAsync(TUser user, IEnumerable <Claim> additionalClaims)
        {
            var userPrincipal = await _userClaimsPrincipalFactory.CreateAsync(user);

            var cliams = new List <Claim>(userPrincipal.Identities.First().Claims);

            foreach (var claim in additionalClaims)
            {
                cliams.Add(claim);
            }

            AddIssuClaims(cliams);


            var token = CreateToken(cliams, _configuration.Value.AccessTokenExpirationMinutes);

            var refreshClaims = cliams.Where(t => t.Type == _userIdClaimType || t.Type == _securityStampClaimType || t.Type == "amr").ToList();

            AddIssuClaims(refreshClaims);

            var refreshToken = CreateToken(refreshClaims, _configuration.Value.RefreshTokenExpirationMinutes);

            var tokenResult = new CreateJwtTokenResult
            {
                Token = token.Token,
                TokenExpirationTime        = token.Expires,
                RefreshToken               = refreshToken.Token,
                RefreshTokenExpirationTime = refreshToken.Expires,
            };

            return(tokenResult);
        }
 public static JwtSignInResult Success(CreateJwtTokenResult tokenResult)
 {
     return(new JwtSignInResult
     {
         Succeeded = true,
         Tokens = tokenResult
     });
 }