예제 #1
0
 public PackageSigningStateService(
     IValidationEntitiesContext validationContext,
     ILogger <PackageSigningStateService> logger)
 {
     _validationContext = validationContext ?? throw new ArgumentNullException(nameof(validationContext));
     _logger            = logger ?? throw new ArgumentNullException(nameof(logger));
 }
예제 #2
0
 public PackageRevalidationStateService(
     IValidationEntitiesContext context,
     IPackageRevalidationInserter inserter,
     ILogger <PackageRevalidationStateService> logger)
 {
     _context  = context ?? throw new ArgumentNullException(nameof(context));
     _inserter = inserter ?? throw new ArgumentNullException(nameof(inserter));
     _logger   = logger ?? throw new ArgumentNullException(nameof(logger));
 }
예제 #3
0
 public ValidatorStateService(
     IValidationEntitiesContext validationContext,
     string validatorName,
     ILogger <ValidatorStateService> logger)
 {
     _validationContext = validationContext ?? throw new ArgumentNullException(nameof(validationContext));
     _logger            = logger ?? throw new ArgumentNullException(nameof(logger));
     _validatorName     = validatorName ?? throw new ArgumentNullException(nameof(validatorName));
 }
예제 #4
0
 public SignaturePartsExtractor(
     ICertificateStore certificateStore,
     IValidationEntitiesContext entitiesContext,
     ILogger <SignaturePartsExtractor> logger)
 {
     _certificateStore = certificateStore ?? throw new ArgumentNullException(nameof(certificateStore));
     _entitiesContext  = entitiesContext ?? throw new ArgumentNullException(nameof(entitiesContext));
     _logger           = logger ?? throw new ArgumentNullException(nameof(logger));
 }
예제 #5
0
 public ValidationStorageService(
     IValidationEntitiesContext validationContext,
     IValidationFileService packageFileService,
     IValidatorProvider validatorProvider,
     ITelemetryService telemetryService,
     ILogger <ValidationStorageService> logger)
 {
     _validationContext  = validationContext ?? throw new ArgumentNullException(nameof(validationContext));
     _packageFileService = packageFileService ?? throw new ArgumentNullException(nameof(packageFileService));
     _validatorProvider  = validatorProvider ?? throw new ArgumentNullException(nameof(validatorProvider));
     _telemetryService   = telemetryService ?? throw new ArgumentNullException(nameof(telemetryService));
     _logger             = logger ?? throw new ArgumentNullException(nameof(logger));
 }
 public SignaturePartsExtractor(
     ICertificateStore certificateStore,
     IValidationEntitiesContext validationEntitiesContext,
     IEntitiesContext galleryEntitiesContext,
     IOptionsSnapshot <ProcessSignatureConfiguration> configuration,
     ILogger <SignaturePartsExtractor> logger)
 {
     _certificateStore          = certificateStore ?? throw new ArgumentNullException(nameof(certificateStore));
     _validationEntitiesContext = validationEntitiesContext ?? throw new ArgumentNullException(nameof(validationEntitiesContext));
     _galleryEntitiesContext    = galleryEntitiesContext ?? throw new ArgumentNullException(nameof(galleryEntitiesContext));
     _configuration             = configuration ?? throw new ArgumentNullException(nameof(configuration));
     _logger = logger ?? throw new ArgumentNullException(nameof(logger));
 }
 public CertificateRevalidator(
     RevalidationConfiguration config,
     IValidationEntitiesContext context,
     IValidateCertificateEnqueuer validationEnqueuer,
     ITelemetryService telemetry,
     ILogger <CertificateRevalidator> logger)
 {
     _config             = config ?? throw new ArgumentNullException(nameof(config));
     _context            = context ?? throw new ArgumentNullException(nameof(context));
     _validationEnqueuer = validationEnqueuer ?? throw new ArgumentNullException(nameof(validationEnqueuer));
     _telemetry          = telemetry ?? throw new ArgumentNullException(nameof(telemetry));
     _logger             = logger ?? throw new ArgumentNullException(nameof(logger));
 }
예제 #8
0
 public RevalidationQueue(
     IGalleryContext galleryContext,
     IValidationEntitiesContext validationContext,
     RevalidationQueueConfiguration config,
     ITelemetryService telemetry,
     ILogger <RevalidationQueue> logger)
 {
     _galleryContext    = galleryContext ?? throw new ArgumentNullException(nameof(galleryContext));
     _validationContext = validationContext ?? throw new ArgumentNullException(nameof(validationContext));
     _config            = config ?? throw new ArgumentNullException(nameof(config));
     _telemetry         = telemetry ?? throw new ArgumentNullException(nameof(telemetry));
     _logger            = logger ?? throw new ArgumentNullException(nameof(logger));
 }
예제 #9
0
        public CertificateValidationService(
            IValidationEntitiesContext context,
            ITelemetryService telemetryService,
            ILogger <CertificateValidationService> logger,
            int maximumValidationFailures = DefaultMaximumValidationFailures)
        {
            _context          = context ?? throw new ArgumentNullException(nameof(context));
            _telemetryService = telemetryService ?? throw new ArgumentNullException(nameof(telemetryService));
            _logger           = logger ?? throw new ArgumentNullException(nameof(logger));

            _maximumValidationFailures = maximumValidationFailures;

            _signatureDeciderFactory = new SignatureDeciderFactory();
        }
예제 #10
0
        /// <summary>
        /// Instantiate a new package certificates validator.
        /// </summary>
        /// <param name="validationContext">The persisted validation context.</param>
        /// <param name="validatorStateService">The service used to persist this validator's state.</param>
        /// <param name="certificateVerificationEnqueuer">The verifier used to verify individual certificates asynchronously.</param>
        /// <param name="logger">The logginator.</param>
        /// <param name="certificateRevalidationThreshold">How stale certificates' statuses can be before revalidating. Defaults to 1 day.</param>
        public PackageCertificatesValidator(
            IValidationEntitiesContext validationContext,
            IValidatorStateService validatorStateService,
            ICertificateVerificationEnqueuer certificateVerificationEnqueuer,
            ILogger <PackageCertificatesValidator> logger,
            TimeSpan?certificateRevalidationThreshold = null)
        {
            _validationContext               = validationContext ?? throw new ArgumentNullException(nameof(validationContext));
            _validatorStateService           = validatorStateService ?? throw new ArgumentNullException(nameof(validatorStateService));
            _certificateVerificationEnqueuer = certificateVerificationEnqueuer ?? throw new ArgumentNullException(nameof(certificateVerificationEnqueuer));
            _logger = logger ?? throw new ArgumentNullException(nameof(logger));

            _certificateRevalidationThresholdTime = certificateRevalidationThreshold ?? DefaultCertificateRevalidationThresholdTime;

            if (_certificateRevalidationThresholdTime < TimeSpan.Zero)
            {
                throw new ArgumentOutOfRangeException(nameof(certificateRevalidationThreshold), "The certificate revalidation threshold time must be a positive value");
            }
        }
예제 #11
0
        public ValidatorStateService(
            IValidationEntitiesContext validationContext,
            Type validatorType,
            ILogger <ValidatorStateService> logger)
        {
            _validationContext = validationContext ?? throw new ArgumentNullException(nameof(validationContext));
            _logger            = logger ?? throw new ArgumentNullException(nameof(logger));

            if (validatorType == null)
            {
                throw new ArgumentNullException(nameof(validatorType));
            }

            if (!typeof(IValidator).IsAssignableFrom(validatorType))
            {
                throw new ArgumentException($"The validator type {validatorType} must extend {nameof(IValidator)}", nameof(validatorType));
            }

            _validatorName = validatorType.Name;
        }
예제 #12
0
        public ScanAndSignProcessor(
            IValidationEntitiesContext validationContext,
            IValidatorStateService validatorStateService,
            ICorePackageService packageService,
            ICriteriaEvaluator <Package> criteriaEvaluator,
            IScanAndSignEnqueuer scanAndSignEnqueuer,
            ISimpleCloudBlobProvider blobProvider,
            IOptionsSnapshot <ScanAndSignConfiguration> configurationAccessor,
            ILogger <ScanAndSignProcessor> logger)
        {
            _validationContext     = validationContext ?? throw new ArgumentNullException(nameof(validationContext));
            _validatorStateService = validatorStateService ?? throw new ArgumentNullException(nameof(validatorStateService));
            _packageService        = packageService ?? throw new ArgumentNullException(nameof(packageService));
            _criteriaEvaluator     = criteriaEvaluator ?? throw new ArgumentNullException(nameof(criteriaEvaluator));
            _scanAndSignEnqueuer   = scanAndSignEnqueuer ?? throw new ArgumentNullException(nameof(scanAndSignEnqueuer));
            _blobProvider          = blobProvider ?? throw new ArgumentNullException(nameof(blobProvider));

            if (configurationAccessor == null)
            {
                throw new ArgumentNullException(nameof(configurationAccessor));
            }
            if (configurationAccessor.Value == null)
            {
                throw new ArgumentException($"{nameof(configurationAccessor.Value)} property is null", nameof(configurationAccessor));
            }
            _configuration = configurationAccessor.Value;

            _logger = logger ?? throw new ArgumentNullException(nameof(logger));

            configurationAccessor = configurationAccessor ?? throw new ArgumentNullException(nameof(configurationAccessor));

            if (configurationAccessor.Value == null)
            {
                throw new ArgumentException($"{nameof(configurationAccessor.Value)} property is null", nameof(configurationAccessor));
            }

            _configuration = configurationAccessor.Value;
        }
 public SymbolsValidationEntitiesService(IValidationEntitiesContext validationEntitiesContext)
 {
     _validationEntitiesContext = validationEntitiesContext ?? throw new ArgumentNullException(nameof(validationEntitiesContext));
 }