コード例 #1
0
        public async Task <string> CreateAsync(Guid userId)
        {
            var token        = _rng.Generate(30, true);
            var refreshToken = new RefreshToken(new AggregateId(), userId, token, DateTime.UtcNow);
            await _refreshTokenRepository.AddAsync(refreshToken);

            return(token);
        }
コード例 #2
0
    public async Task <string> CreateAsync(int userId)
    {
        var token = _rng.Generate(removeSpecialChars: true);
        await _refreshTokenRepository.Add(new RefreshToken(token, DateTime.UtcNow, userId, DateTime.UtcNow.AddDays(7)));


        return(token);
    }
コード例 #3
0
        private async Task <string> CreateRefreshTokenAsync(Guid userId)
        {
            var token        = _rng.Generate(30, true);
            var refreshToken = new RefreshToken(new AggregateId(), userId, token, _clock.Current());
            await _refreshTokenRepository.AddAsync(refreshToken);

            return(token);
        }
コード例 #4
0
        public async Task <string> CreateAsync(Guid userId)
        {
            var token        = _rng.Generate(30, true);
            var now          = _clock.CurrentDate();
            var expires      = now.Add(_options.ExpiryRefreshToken);
            var refreshToken = new RefreshToken(Guid.NewGuid(), userId, token, DateTime.UtcNow, expires);
            await _refreshTokenRepository.DeleteAsync(userId);

            await _refreshTokenRepository.AddAsync(refreshToken);

            return(token);
        }
コード例 #5
0
 public RefreshToken Create(Guid userId)
 => new RefreshToken(Guid.NewGuid(), userId, _rng.Generate(), _dateTimeProvider.Now);
コード例 #6
0
 public RefreshToken Create(int userId)
 => new RefreshToken(userId, _rng.Generate(), _dateTimeProvider.Now);