예제 #1
0
        /// <summary>
        /// Scheduled Tasks Manager
        /// </summary>
        public ScheduledTasksCoordinator(
            ILogger <ScheduledTasksCoordinator> logger,
            IApplicationLifetime applicationLifetime,
            IOptions <ScheduledTasksStorage> tasksStorage,
            IJobsRunnerTimer jobsRunnerTimer,
            IThisApplication thisApplication,
            IServiceProvider serviceProvider)
        {
            logger.CheckArgumentNull(nameof(logger));
            applicationLifetime.CheckArgumentNull(nameof(applicationLifetime));
            tasksStorage.CheckArgumentNull(nameof(tasksStorage));
            jobsRunnerTimer.CheckArgumentNull(nameof(jobsRunnerTimer));
            thisApplication.CheckArgumentNull(nameof(thisApplication));
            serviceProvider.CheckArgumentNull(nameof(serviceProvider));

            _logger          = logger;
            _tasksStorage    = tasksStorage;
            _jobsRunnerTimer = jobsRunnerTimer;
            _thisApplication = thisApplication;
            _serviceProvider = serviceProvider;
            applicationLifetime.ApplicationStopping.Register(() =>
            {
                _logger.LogInformation("Application is stopping ... .");
                disposeResources().Wait();
            });
        }
예제 #2
0
        public RecaptchaService(IOptions <RecaptchaOptions> options)
        {
            options.CheckArgumentNull(nameof(options));

            _options = options.Value;

            _options.ResponseValidationEndpoint.CheckMandatoryOption(nameof(_options.ResponseValidationEndpoint));

            _options.JavaScriptUrl.CheckMandatoryOption(nameof(_options.JavaScriptUrl));

            _options.SiteKey.CheckMandatoryOption(nameof(_options.SiteKey));

            _options.SecretKey.CheckMandatoryOption(nameof(_options.SecretKey));

            _controlSettings     = _options.ControlSettings ?? new RecaptchaControlSettings();
            _backChannel         = new HttpClient(_options.BackchannelHttpHandler ?? new HttpClientHandler());
            _backChannel.Timeout = _options.BackchannelTimeout;
        }
예제 #3
0
        public AuthenticatorService(IOptions <AuthenticatorServiceOptions> options, ISystemTime systemTime)
        {
            options.CheckArgumentNull(nameof(options));
            systemTime.CheckArgumentNull(nameof(systemTime));

            options.Value.Issuer.CheckMandatoryOption(nameof(options.Value.Issuer));

            if (options.Value.NumberOfDigits < 6 || options.Value.NumberOfDigits > 8)
            {
                throw new ArgumentException(Resources.Exception_InvalidNumberOfDigits);
            }

            if (options.Value.PeriodInSeconds < 30)
            {
                throw new ArgumentException(Resources.Exception_InvalidPeriodInSeconds);
            }

            _options    = options.Value;
            _systemTime = systemTime;
        }