async Task RenewSessionActivity(AppyOnePasswordSession session, CancellationToken cancellationToken)
        {
            _logger.LogInformation($"Self-renewing the session activity after {AutoRenewDelayInMins} min.");

            var query = new GetOnePasswordVaultsQuery
            {
                Organization = session.Organization !,
                SessionToken = session.SessionToken !
            };

            await _onePasswordTool.Execute(query, cancellationToken);

            _logger.LogInformation($"Session activity automatically renewed after {AutoRenewDelayInMins} min.");

            _logger.LogInformation($"Your session activity will be auto renewed in {AutoRenewDelayInMins} min.");
        }

        async Task AutoRenewSessionActivity(AppyOnePasswordSession session, CancellationToken cancellationToken)
        {
            _logger.LogInformation($"Your session activity will be auto renewed in {AutoRenewDelayInMins} min.");

            await _toolScheduler.ScheduleJobAndBlock(
                job : () => RenewSessionActivity(session, cancellationToken),
                interval : TimeSpan.FromMinutes(AutoRenewDelayInMins),
                cancellationToken);
        }
        public async Task <GetOnePasswordNoteQueryResult> Execute(GetOnePasswordNoteQuery query, CancellationToken cancellationToken = default)
        {
            var session = await _sessionStorage.GetCurrent();

            query.Organization = (query.Organization ?? session.Organization) !;
            query.Environment  = (query.Environment ?? session.Environment) !;
            query.Vault        = (query.Vault ?? session.Vault) !;
            query.SessionToken = (query.SessionToken ?? session.SessionToken) !;

            return(await _innerTool.Execute(query, cancellationToken));
        }
Example #3
0
 public async Task <GetOnePasswordNoteQueryResult> Execute(GetOnePasswordNoteQuery query, CancellationToken cancellationToken = default)
 {
     _validator.ValidateAndThrow(query);
     return(await _innerTool.Execute(query, cancellationToken));
 }