Beispiel #1
0
 public PackageUploadService(
     IPackageService packageService,
     IPackageFileService packageFileService,
     IEntitiesContext entitiesContext,
     IReservedNamespaceService reservedNamespaceService,
     IValidationService validationService,
     IAppConfiguration config,
     ITyposquattingService typosquattingService,
     ITelemetryService telemetryService,
     ICoreLicenseFileService coreLicenseFileService,
     IDiagnosticsService diagnosticsService,
     IFeatureFlagService featureFlagService,
     IPackageVulnerabilityService vulnerabilityService)
 {
     _packageService           = packageService ?? throw new ArgumentNullException(nameof(packageService));
     _packageFileService       = packageFileService ?? throw new ArgumentNullException(nameof(packageFileService));
     _entitiesContext          = entitiesContext ?? throw new ArgumentNullException(nameof(entitiesContext));
     _reservedNamespaceService = reservedNamespaceService ?? throw new ArgumentNullException(nameof(reservedNamespaceService));
     _validationService        = validationService ?? throw new ArgumentNullException(nameof(validationService));
     _config = config ?? throw new ArgumentNullException(nameof(config));
     _typosquattingService   = typosquattingService ?? throw new ArgumentNullException(nameof(typosquattingService));
     _telemetryService       = telemetryService ?? throw new ArgumentNullException(nameof(telemetryService));
     _coreLicenseFileService = coreLicenseFileService ?? throw new ArgumentNullException(nameof(coreLicenseFileService));
     if (diagnosticsService == null)
     {
         throw new ArgumentNullException(nameof(diagnosticsService));
     }
     _trace = diagnosticsService.GetSource(nameof(PackageUploadService));
     _featureFlagService   = featureFlagService ?? throw new ArgumentNullException(nameof(featureFlagService));
     _vulnerabilityService = vulnerabilityService ?? throw new ArgumentNullException(nameof(vulnerabilityService));
 }
Beispiel #2
0
 public ApiController(
     IApiScopeEvaluator apiScopeEvaluator,
     IEntitiesContext entitiesContext,
     IPackageService packageService,
     IPackageFileService packageFileService,
     IUserService userService,
     INuGetExeDownloaderService nugetExeDownloaderService,
     IContentService contentService,
     IIndexingService indexingService,
     ISearchService searchService,
     IAutomaticallyCuratePackageCommand autoCuratePackage,
     IStatusService statusService,
     IStatisticsService statisticsService,
     IMessageService messageService,
     IAuditingService auditingService,
     IGalleryConfigurationService configurationService,
     ITelemetryService telemetryService,
     AuthenticationService authenticationService,
     ICredentialBuilder credentialBuilder,
     ISecurityPolicyService securityPolicies,
     IReservedNamespaceService reservedNamespaceService,
     IPackageUploadService packageUploadService)
     : this(apiScopeEvaluator, entitiesContext, packageService, packageFileService, userService, nugetExeDownloaderService, contentService,
            indexingService, searchService, autoCuratePackage, statusService, messageService, auditingService,
            configurationService, telemetryService, authenticationService, credentialBuilder, securityPolicies,
            reservedNamespaceService, packageUploadService)
 {
     StatisticsService = statisticsService;
 }
Beispiel #3
0
 public DeleteAccountService(IEntityRepository <AccountDelete> accountDeleteRepository,
                             IEntityRepository <User> userRepository,
                             IEntityRepository <Scope> scopeRepository,
                             IEntitiesContext entitiesContext,
                             IPackageService packageService,
                             IPackageOwnershipManagementService packageOwnershipManagementService,
                             IReservedNamespaceService reservedNamespaceService,
                             ISecurityPolicyService securityPolicyService,
                             AuthenticationService authService,
                             ISupportRequestService supportRequestService,
                             IAuditingService auditingService,
                             ITelemetryService telemetryService
                             )
 {
     _accountDeleteRepository           = accountDeleteRepository ?? throw new ArgumentNullException(nameof(accountDeleteRepository));
     _userRepository                    = userRepository ?? throw new ArgumentNullException(nameof(userRepository));
     _scopeRepository                   = scopeRepository ?? throw new ArgumentNullException(nameof(scopeRepository));
     _entitiesContext                   = entitiesContext ?? throw new ArgumentNullException(nameof(entitiesContext));
     _packageService                    = packageService ?? throw new ArgumentNullException(nameof(packageService));
     _packageOwnershipManagementService = packageOwnershipManagementService ?? throw new ArgumentNullException(nameof(packageOwnershipManagementService));
     _reservedNamespaceService          = reservedNamespaceService ?? throw new ArgumentNullException(nameof(reservedNamespaceService));
     _securityPolicyService             = securityPolicyService ?? throw new ArgumentNullException(nameof(securityPolicyService));
     _authService           = authService ?? throw new ArgumentNullException(nameof(authService));
     _supportRequestService = supportRequestService ?? throw new ArgumentNullException(nameof(supportRequestService));
     _auditingService       = auditingService ?? throw new ArgumentNullException(nameof(auditingService));
     _telemetryService      = telemetryService ?? throw new ArgumentNullException(nameof(telemetryService));
 }
Beispiel #4
0
        private static PackageSecurityPolicyEvaluationContext CreateTestContext(
            bool microsoftUserExists,
            IEnumerable <UserSecurityPolicy> policies,
            Package package,
            bool packageRegistrationAlreadyExists,
            IPackageOwnershipManagementService packageOwnershipManagementService = null,
            IReservedNamespaceService reservedNamespaceService = null)
        {
            var userService = new Mock <IUserService>(MockBehavior.Strict);

            if (microsoftUserExists)
            {
                userService
                .Setup(m => m.FindByUsername(MicrosoftTeamSubscription.MicrosoftUsername, false))
                .Returns(Fakes.RequiredCoOwner);
            }
            else
            {
                userService
                .Setup(m => m.FindByUsername(MicrosoftTeamSubscription.MicrosoftUsername, false))
                .Returns((User)null);
            }

            packageOwnershipManagementService = packageOwnershipManagementService ?? new Mock <IPackageOwnershipManagementService>(MockBehavior.Strict).Object;

            var context = new PackageSecurityPolicyEvaluationContext(
                userService.Object,
                packageOwnershipManagementService,
                policies,
                package,
                It.IsAny <HttpContextBase>());

            return(context);
        }
Beispiel #5
0
        public PackageUploadService(
            IPackageService packageService,
            IPackageFileService packageFileService,
            IEntitiesContext entitiesContext,
            IReservedNamespaceService reservedNamespaceService,
            IValidationService validationService,
            ICoreLicenseFileService coreLicenseFileService,
            ICoreReadmeFileService coreReadmeFileService,
            IDiagnosticsService diagnosticsService,
            IPackageVulnerabilitiesManagementService vulnerabilityService,
            IPackageMetadataValidationService metadataValidationService)
        {
            _packageService           = packageService ?? throw new ArgumentNullException(nameof(packageService));
            _packageFileService       = packageFileService ?? throw new ArgumentNullException(nameof(packageFileService));
            _entitiesContext          = entitiesContext ?? throw new ArgumentNullException(nameof(entitiesContext));
            _reservedNamespaceService = reservedNamespaceService ?? throw new ArgumentNullException(nameof(reservedNamespaceService));
            _validationService        = validationService ?? throw new ArgumentNullException(nameof(validationService));
            _coreLicenseFileService   = coreLicenseFileService ?? throw new ArgumentNullException(nameof(coreLicenseFileService));
            _coreReadmeFileService    = coreReadmeFileService ?? throw new ArgumentNullException(nameof(coreReadmeFileService));

            if (diagnosticsService == null)
            {
                throw new ArgumentNullException(nameof(diagnosticsService));
            }
            _vulnerabilityService      = vulnerabilityService ?? throw new ArgumentNullException(nameof(vulnerabilityService));
            _metadataValidationService = metadataValidationService ?? throw new ArgumentNullException(nameof(metadataValidationService));
        }
 public PackageUploadService(
     IPackageService packageService,
     IReservedNamespaceService reservedNamespaceService)
 {
     _packageService           = packageService;
     _reservedNamespaceService = reservedNamespaceService;
 }
        public TyposquattingService(IContentObjectService contentObjectService, IPackageService packageService, IReservedNamespaceService reservedNamespaceService, ITelemetryService telemetryService)
        {
            _contentObjectService     = contentObjectService ?? throw new ArgumentNullException(nameof(contentObjectService));
            _packageService           = packageService ?? throw new ArgumentNullException(nameof(packageService));
            _reservedNamespaceService = reservedNamespaceService ?? throw new ArgumentNullException(nameof(reservedNamespaceService));
            _telemetryService         = telemetryService ?? throw new ArgumentNullException(nameof(telemetryService));

            TyposquattingCheckListLength = _contentObjectService.TyposquattingConfiguration.PackageIdChecklistLength;
        }
 public TyposquattingService(IContentObjectService contentObjectService,
                             IPackageService packageService,
                             IReservedNamespaceService reservedNamespaceService,
                             ITelemetryService telemetryService,
                             ITyposquattingCheckListCacheService typosquattingCheckListCacheService)
 {
     _contentObjectService               = contentObjectService ?? throw new ArgumentNullException(nameof(contentObjectService));
     _packageService                     = packageService ?? throw new ArgumentNullException(nameof(packageService));
     _reservedNamespaceService           = reservedNamespaceService ?? throw new ArgumentNullException(nameof(reservedNamespaceService));
     _telemetryService                   = telemetryService ?? throw new ArgumentNullException(nameof(telemetryService));
     _typosquattingCheckListCacheService = typosquattingCheckListCacheService ?? throw new ArgumentNullException(nameof(typosquattingCheckListCacheService));
 }
Beispiel #9
0
 public PackageUploadService(
     IPackageService packageService,
     IPackageFileService packageFileService,
     IEntitiesContext entitiesContext,
     IReservedNamespaceService reservedNamespaceService,
     IValidationService validationService)
 {
     _packageService           = packageService ?? throw new ArgumentNullException(nameof(packageService));
     _packageFileService       = packageFileService ?? throw new ArgumentNullException(nameof(packageFileService));
     _entitiesContext          = entitiesContext ?? throw new ArgumentNullException(nameof(entitiesContext));
     _reservedNamespaceService = reservedNamespaceService ?? throw new ArgumentNullException(nameof(reservedNamespaceService));
     _validationService        = validationService ?? throw new ArgumentNullException(nameof(validationService));
 }
 public PackageOwnershipManagementService(
     IEntitiesContext entitiesContext,
     IPackageService packageService,
     IReservedNamespaceService reservedNamespaceService,
     IPackageOwnerRequestService packageOwnerRequestService,
     IAuditingService auditingService)
 {
     _entitiesContext            = entitiesContext ?? throw new ArgumentNullException(nameof(entitiesContext));
     _packageService             = packageService ?? throw new ArgumentNullException(nameof(packageService));
     _reservedNamespaceService   = reservedNamespaceService ?? throw new ArgumentNullException(nameof(reservedNamespaceService));
     _packageOwnerRequestService = packageOwnerRequestService ?? throw new ArgumentNullException(nameof(packageOwnerRequestService));
     _auditingService            = auditingService ?? throw new ArgumentNullException(nameof(auditingService));
 }
 public PackageUploadService(
     IPackageService packageService,
     IPackageFileService packageFileService,
     IEntitiesContext entitiesContext,
     IReservedNamespaceService reservedNamespaceService,
     IValidationService validationService,
     IAppConfiguration config,
     ITyposquattingService typosquattingService)
 {
     _packageService           = packageService ?? throw new ArgumentNullException(nameof(packageService));
     _packageFileService       = packageFileService ?? throw new ArgumentNullException(nameof(packageFileService));
     _entitiesContext          = entitiesContext ?? throw new ArgumentNullException(nameof(entitiesContext));
     _reservedNamespaceService = reservedNamespaceService ?? throw new ArgumentNullException(nameof(reservedNamespaceService));
     _validationService        = validationService ?? throw new ArgumentNullException(nameof(validationService));
     _config = config ?? throw new ArgumentNullException(nameof(config));
     _typosquattingService = typosquattingService ?? throw new ArgumentNullException(nameof(typosquattingService));
 }
Beispiel #12
0
 public ApiController(
     IApiScopeEvaluator apiScopeEvaluator,
     IEntitiesContext entitiesContext,
     IPackageService packageService,
     IPackageFileService packageFileService,
     IUserService userService,
     INuGetExeDownloaderService nugetExeDownloaderService,
     IContentService contentService,
     IIndexingService indexingService,
     ISearchService searchService,
     IAutomaticallyCuratePackageCommand autoCuratePackage,
     IStatusService statusService,
     IMessageService messageService,
     IAuditingService auditingService,
     IGalleryConfigurationService configurationService,
     ITelemetryService telemetryService,
     AuthenticationService authenticationService,
     ICredentialBuilder credentialBuilder,
     ISecurityPolicyService securityPolicies,
     IReservedNamespaceService reservedNamespaceService,
     IPackageUploadService packageUploadService)
 {
     ApiScopeEvaluator         = apiScopeEvaluator;
     EntitiesContext           = entitiesContext;
     PackageService            = packageService;
     PackageFileService        = packageFileService;
     UserService               = userService;
     NugetExeDownloaderService = nugetExeDownloaderService;
     ContentService            = contentService;
     IndexingService           = indexingService;
     SearchService             = searchService;
     AutoCuratePackage         = autoCuratePackage;
     StatusService             = statusService;
     MessageService            = messageService;
     AuditingService           = auditingService;
     ConfigurationService      = configurationService;
     TelemetryService          = telemetryService;
     AuthenticationService     = authenticationService;
     CredentialBuilder         = credentialBuilder;
     SecurityPolicyService     = securityPolicies;
     ReservedNamespaceService  = reservedNamespaceService;
     PackageUploadService      = packageUploadService;
     StatisticsService         = null;
 }
 public ReservedNamespaceController(IReservedNamespaceService reservedNamespaceService)
 {
     _reservedNamespaceService = reservedNamespaceService ?? throw new ArgumentNullException(nameof(reservedNamespaceService));
 }
 public ActionOnNewPackageContext(string packageId, IReservedNamespaceService reservedNamespaceService)
 {
     PackageId = packageId;
     ReservedNamespaceService = reservedNamespaceService ?? throw new ArgumentNullException(nameof(reservedNamespaceService));
 }