コード例 #1
0
        /// <summary>
        /// Create and new refresh token
        /// </summary>
        /// <param name="subject"></param>
        /// <returns></returns>
        private async Task <(String refreshTokenId, DateTime refreshTokenExpiresUtc)> CreateRefreshTokenAsync(JwtSecurityToken token)
        {
            var refreshToken = new RefreshTokenModel(
                subject: token.Subject,
                issuedUtc: DateTime.UtcNow,
                expiresIn: _refreshTokenLifetime,
                accessToken: new JwtSecurityTokenHandler().WriteToken(token));

            var refreshTokenId = await _refreshTokenRepository.SaveRefreshTokenAsync(refreshToken);

            return(refreshTokenId, refreshToken.ExpiresUtc);
        }