예제 #1
0
        private async Task Initialize(CancellationToken token)
        {
            token.ThrowIfCancellationRequested();

            var daysUntilClusterExpireWarningThreshold = this.GetSettingParameterValue(
                ObserverConstants.CertificateObserverConfigurationSectionName,
                ObserverConstants.CertificateObserverDaysUntilClusterExpiryWarningThreshold);

            if (!string.IsNullOrEmpty(daysUntilClusterExpireWarningThreshold))
            {
                this.DaysUntilClusterExpireWarningThreshold = int.Parse(daysUntilClusterExpireWarningThreshold);
            }
            else
            {
                this.DaysUntilClusterExpireWarningThreshold = 14;
            }

            var daysUntilAppExpireWarningClusterThreshold = this.GetSettingParameterValue(
                ObserverConstants.CertificateObserverConfigurationSectionName,
                ObserverConstants.CertificateObserverDaysUntilAppExpiryWarningThreshold);

            if (!string.IsNullOrEmpty(daysUntilAppExpireWarningClusterThreshold))
            {
                this.DaysUntilAppExpireWarningThreshold = int.Parse(daysUntilAppExpireWarningClusterThreshold);
            }
            else
            {
                this.DaysUntilAppExpireWarningThreshold = 14;
            }

            var appThumbprintsToObserve = this.GetSettingParameterValue(
                ObserverConstants.CertificateObserverConfigurationSectionName,
                ObserverConstants.CertificateObserverAppCertificateThumbprints);

            if (!string.IsNullOrEmpty(appThumbprintsToObserve))
            {
                this.AppCertificateThumbprintsToObserve = JsonHelper.ConvertFromString <List <string> >(appThumbprintsToObserve);
            }
            else
            {
                this.AppCertificateThumbprintsToObserve = new List <string>();
            }

            var appCommonNamesToObserve = this.GetSettingParameterValue(
                ObserverConstants.CertificateObserverConfigurationSectionName,
                ObserverConstants.CertificateObserverAppCertificateCommonNames);

            if (!string.IsNullOrEmpty(appThumbprintsToObserve))
            {
                this.AppCertificateCommonNamesToObserve = JsonHelper.ConvertFromString <List <string> >(appCommonNamesToObserve);
            }
            else
            {
                this.AppCertificateCommonNamesToObserve = new List <string>();
            }

            await this.GetSecurityTypes(token).ConfigureAwait(true);
        }