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); }
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); }
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); }
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); }
public RefreshToken Create(Guid userId) => new RefreshToken(Guid.NewGuid(), userId, _rng.Generate(), _dateTimeProvider.Now);
public RefreshToken Create(int userId) => new RefreshToken(userId, _rng.Generate(), _dateTimeProvider.Now);