Exemplo n.º 1
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="repository">Required.</param>
 /// <param name="authenticationService">Optional. If this is not supplied Upload/Delete is not available (requests returns 403 Forbidden)</param>
 protected NuGetODataController(
     IServerPackageRepository repository,
     IPackageAuthenticationService authenticationService = null)
 {
     _serverRepository      = repository ?? throw new ArgumentNullException(nameof(repository));
     _authenticationService = authenticationService;
 }
Exemplo n.º 2
0
		public PackageService(
			IServerPackageRepository repository,
			IPackageAuthenticationService authenticationService,
			NLog.ILogger logger)
		{
			_serverRepository = repository;
			_authenticationService = authenticationService;
			_logger = logger;
		}
Exemplo n.º 3
0
        public DefaultServiceResolver()
        {
            _hashProvider = new CryptoHashProvider(Constants.HashAlgorithm);

            _packageRepository = new ServerPackageRepository(PackageUtility.PackagePhysicalPath, _hashProvider, new TraceLogger());

            _packageAuthenticationService = new PackageAuthenticationService();

            _packageService = new PackageService(_packageRepository, _packageAuthenticationService);
        }
        protected override async Task <NuGetAuthenticationResult> IsAuthorized(IPackageAuthenticationService authenticationService)
        {
            GetUserCredentials(out var username, out var password);
            var result = await authenticationService.AuthenticateAsync(username, password, default);

            if (!result.Succeeded && string.IsNullOrEmpty(result.Realm))
            {
                return(NuGetAuthenticationResult.Fail(result.Message, result.Server, "AvantiPoint Package Feed"));
            }

            return(result);
        }
Exemplo n.º 5
0
 public PackageService(IServerPackageRepository repository,
                       IPackageAuthenticationService authenticationService)
 {
     _serverRepository = repository;
     _authenticationService = authenticationService;
 }
 public PackageService(IServerPackageRepository repository,
                       IPackageAuthenticationService authenticationService)
 {
     _serverRepository      = repository;
     _authenticationService = authenticationService;
 }
Exemplo n.º 7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AzurePackageService"/> class.
 /// </summary>
 /// <param name="repository">
 /// Repository of packages
 /// </param>
 /// <param name="authenticationService">
 /// Authentication service
 /// </param>
 public AzurePackageService(AzureServerPackageRepository repository, IPackageAuthenticationService authenticationService)
 {
     this.repository     = repository;
     this.packageService = new PackageService(repository, authenticationService);
 }
 public AzurePackageService(AzureServerPackageRepository repository,
                            IPackageAuthenticationService authenticationService)
     : base(repository, authenticationService)
 {
     _azureRepository = repository;
 }
Exemplo n.º 9
0
 protected override Task <NuGetAuthenticationResult> IsAuthorized(IPackageAuthenticationService authenticationService)
 {
     GetApiToken(out var apiKey);
     return(authenticationService.AuthenticateAsync(apiKey, default));
 }
 public AzurePackageService(AzureServerPackageRepository repository,
                       IPackageAuthenticationService authenticationService)
     : base(repository, authenticationService)
 {
     _azureRepository = repository;
 }
 protected abstract Task <NuGetAuthenticationResult> IsAuthorized(IPackageAuthenticationService authenticationService);
Exemplo n.º 12
0
 public NuGetPublicODataController(IPackageAuthenticationService packageAuthenticationService)
     : base(ServiceLocator.Current.GetInstance <IServerPackageRepository>("NuGetPublic"), packageAuthenticationService)
 {
 }
Exemplo n.º 13
0
 public SymbolPackageService(IServerPackageRepository repository, IPackageAuthenticationService authenticationService) : base(repository, authenticationService)
 {
 }