예제 #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="NotificationSettingsJob"/> class.
 /// </summary>
 /// <param name="configuration">The configuration to use.</param>
 /// <param name="logger">The logger to use.</param>
 /// <param name="notificationSettingsDelegate">The email delegate to use.</param>
 /// <param name="authDelegate">The OAuth2 authentication service.</param>
 public NotificationSettingsJob(IConfiguration configuration, ILogger <NotificationSettingsJob> logger, INotificationSettingsDelegate notificationSettingsDelegate, IAuthenticationDelegate authDelegate)
 {
     this.configuration = configuration !;
     this.logger        = logger;
     this.notificationSettingsDelegate = notificationSettingsDelegate;
     this.authDelegate = authDelegate;
     this.jobEnabled   = this.configuration.GetSection(JobConfigKey).GetValue <bool>(JobEnabledKey, true);
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="NotificationSettingsService"/> class.
 /// </summary>
 /// <param name="logger">The injected logger provider.</param>
 /// <param name="jobClient">The JobScheduler queue client.</param>
 /// <param name="notificationSettingsDelegate">Notification Settings delegate to be used.</param>
 public NotificationSettingsService(
     ILogger <NotificationSettingsService> logger,
     IBackgroundJobClient jobClient,
     INotificationSettingsDelegate notificationSettingsDelegate)
 {
     this.logger    = logger;
     this.jobClient = jobClient;
     this.notificationSettingsDelegate = notificationSettingsDelegate;
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="NotificationSettingsJob"/> class.
        /// </summary>
        /// <param name="configuration">The configuration to use.</param>
        /// <param name="logger">The logger to use.</param>
        /// <param name="notificationSettingsDelegate">The email delegate to use.</param>
        /// <param name="authDelegate">The OAuth2 authentication service.</param>
        /// <param name="eventLogDelegate">The Eventlog delegate.</param>
        public NotificationSettingsJob(
            IConfiguration configuration,
            ILogger <NotificationSettingsJob> logger,
            INotificationSettingsDelegate notificationSettingsDelegate,
            IAuthenticationDelegate authDelegate,
            IEventLogDelegate eventLogDelegate)
        {
            this.configuration = configuration !;
            this.logger        = logger;
            this.notificationSettingsDelegate = notificationSettingsDelegate;
            this.authDelegate     = authDelegate;
            this.eventLogDelegate = eventLogDelegate;
            this.jobEnabled       = this.configuration.GetSection(JobConfigKey).GetValue <bool>(JobEnabledKey, true);

            IConfigurationSection?configSection = configuration?.GetSection(AuthConfigSectionName);

            this.tokenUri = configSection.GetValue <Uri>(@"TokenUri");

            this.tokenRequest = new ClientCredentialsTokenRequest();
            configSection.Bind(this.tokenRequest); // Client ID, Client Secret, Audience, Username, Password
        }