예제 #1
0
        public int Step1(string username, byte[] renewToken)
        {
            if (CheckVendor.NotValidRenewToken(renewToken))
            {
                return(03_0009);
            }

            var authRenew = new AuthRenew();

            authRenew.Username = username;

            authRenew.RenewToken = renewToken;

            authRenew.ReportTime = DateTime.Now;

            var result = ApiCall.SessionRenew.Call(null, new MilvanethProtocol {
                Context = null, Data = authRenew
            });

            if (!(result.Data is AuthResponse ar))
            {
                return(02_0007);
            }

            if (!CheckVendor.NotValidResponse(ar))
            {
                _authResponse = ar;
            }

            return(ar.Message);
        }
예제 #2
0
 public static bool Check(this AuthRenew data)
 {
     return(data.RenewToken != null &&
            data.RenewToken.Length == GlobalConfig.TOKEN_LENGTH &&
            IsValidReportTime(data.ReportTime) &&
            IsValidUsername(data.Username));
 }
 public async Task InsertAsync(AuthRenew authRenew, CancellationToken cancellationToken = default)
 {
     await _dbContext.RenewTokens.InsertOneAsync(
         _mapper.Map <AuthRenewEntity>(authRenew),
         null,
         cancellationToken
         );
 }
예제 #4
0
 public async Task AddAsync(AuthRenew authRenew, CancellationToken cancellationToken = default)
 {
     await _authRenewRepository.InsertAsync(authRenew, cancellationToken);
 }