private void UpdateDefaultOauthParameters() { OauthParameters["nonce"] = RngHelper.GetRandomHexString(10); OauthParameters["timestamp"] = DateTimeOffset.UtcNow.ToUnixTimeSeconds().ToString(); OauthParameters["consumer_key"] = _consumerKey; OauthParameters["signature_method"] = SignatureMethod; OauthParameters["version"] = Version; }
public async Task <UserAccessToken> CreateUserAccessTokenAsync(int userId, CreateAccessTokenRequest request) { using (var uow = _unitOfWorkFactory.CreateUnitOfWork()) { var token = new UserAccessToken { Id = Guid.NewGuid(), Key = RngHelper.GetRandomHexString(64), Name = request.Name, UserId = userId, DateCreated = _timeService.UtcNow }; uow.UserAccessTokenRepository.Add(token); await uow.SaveChangesAsync(); return(token); } }
public string GetRandomHexString(int byteCount) { return(RngHelper.GetRandomHexString(byteCount)); }