/// <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, 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); }
/// <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 }