public async Task <Tokens> GetRefreshTokenAsync(string refreshToken)
        {
            LinUser user = await _userRepository.GetUserAsync(r => r.RefreshToken == refreshToken);

            if (user.IsNull())
            {
                throw new LinCmsException("该refreshToken无效!");
            }

            if (DateTime.Compare(user.LastLoginTime, DateTime.Now) > new TimeSpan(30, 0, 0, 0).Ticks)
            {
                throw new LinCmsException("请重新登录", ErrorCode.RefreshTokenError);
            }

            List <Claim> claims = new List <Claim>()
            {
                new Claim(ClaimTypes.NameIdentifier, user.Id.ToString()),
                new Claim(ClaimTypes.Email, user.Email ?? ""),
                new Claim(ClaimTypes.GivenName, user.Nickname ?? ""),
                new Claim(ClaimTypes.Name, user.Username ?? ""),
            };

            _logger.LogInformation($"用户{user.Username},JwtRefreshToken 刷新-登录成功,{JsonConvert.SerializeObject(claims)}");

            string token = _jsonWebTokenService.Encode(claims);

            refreshToken = GenerateToken();
            user.AddRefreshToken(refreshToken);
            await _userRepository.UpdateAsync(user);

            return(new Tokens(token, refreshToken));
        }
        public async Task <Tokens> GetRefreshTokenAsync(string refreshToken)
        {
            LinUser user = await _userRepository.GetUserAsync(r => r.RefreshToken == refreshToken);

            if (user.IsNull())
            {
                throw new LinCmsException("该refreshToken无效!");
            }

            if (DateTime.Compare(user.LastLoginTime, DateTime.Now) > new TimeSpan(30, 0, 0, 0).Ticks)
            {
                throw new LinCmsException("请重新登录", ErrorCode.RefreshTokenError);
            }

            Tokens tokens = await CreateTokenAsync(user);

            _logger.LogInformation($"用户{user.Username},JwtRefreshToken 刷新-登录成功");

            return(tokens);
        }