Exemple #1
0
 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;
 }
Exemple #2
0
        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);
            }
        }
Exemple #3
0
 public string GetRandomHexString(int byteCount)
 {
     return(RngHelper.GetRandomHexString(byteCount));
 }