Esempio n. 1
0
 public VcsValidator(string serviceUrl, string callbackUrl, string contactAlias, string submitterAlias, string packageUrlTemplate, ILoggerFactory loggerFactory)
 {
     _logger             = loggerFactory.CreateLogger <VcsValidator>();
     _packageUrlTemplate = packageUrlTemplate;
     _scanningService    = new VcsVirusScanningService(new Uri(serviceUrl), "DIRECT", contactAlias, submitterAlias);
     _callbackUrl        = new Uri(callbackUrl);
 }
Esempio n. 2
0
        public override void Init(IDictionary <string, string> jobArgsDictionary)
        {
            _galleryBaseAddress = JobConfigurationManager.GetArgument(jobArgsDictionary, JobArgumentNames.GalleryBaseAddress);

            var storageConnectionString = JobConfigurationManager.GetArgument(jobArgsDictionary, JobArgumentNames.DataStorageAccount);

            _cloudStorageAccount = CreateCloudStorageAccount(JobArgumentNames.DataStorageAccount, storageConnectionString);

            _containerName = JobConfigurationManager.GetArgument(jobArgsDictionary, JobArgumentNames.ContainerName);

            _runValidationTasks     = JobConfigurationManager.GetArgument(jobArgsDictionary, JobArgumentNames.RunValidationTasks).Split(';');
            _requestValidationTasks = JobConfigurationManager.GetArgument(jobArgsDictionary, JobArgumentNames.RequestValidationTasks).Split(';');
            _batchSize = JobConfigurationManager.TryGetIntArgument(jobArgsDictionary, JobArgumentNames.BatchSize) ?? DefaultBatchSize;

            // Add validators
            if (_runValidationTasks.Contains(VcsValidator.ValidatorName))
            {
                var serviceUrl         = new Uri(JobConfigurationManager.GetArgument(jobArgsDictionary, JobArgumentNames.VcsValidatorServiceUrl));
                var consumerCode       = "DIRECT";
                var callbackUrl        = new Uri(JobConfigurationManager.GetArgument(jobArgsDictionary, JobArgumentNames.VcsValidatorCallbackUrl));
                var packageUrlTemplate = JobConfigurationManager.GetArgument(jobArgsDictionary, JobArgumentNames.PackageUrlTemplate);
                var submitterAlias     = JobConfigurationManager.GetArgument(jobArgsDictionary, JobArgumentNames.VcsValidatorSubmitterAlias);

                // if contact alias set, use it, if not, use submitter alias.
                var contactAlias = JobConfigurationManager.TryGetArgument(jobArgsDictionary, JobArgumentNames.VcsContactAlias) ?? submitterAlias;

                var scanningService = new VcsVirusScanningService(
                    serviceUrl,
                    consumerCode,
                    contactAlias,
                    submitterAlias,
                    LoggerFactory);

                _validators.Add(new VcsValidator(
                                    callbackUrl,
                                    packageUrlTemplate,
                                    scanningService,
                                    LoggerFactory.CreateLogger <VcsValidator>()));
            }
        }