Esempio n. 1
0
        public WapAuthenticationMiddleware(RequestDelegate next, IOcelotConfigurationProvider ocelotConfigurationProvider, IUrlPathToUrlTemplateMatcher urlMatcher, IPlaceholderNameAndValueFinder urlPathPlaceholderNameAndValueFinder)
        {
            _ocelotConfigurationProvider = ocelotConfigurationProvider;
            _urlMatcher = urlMatcher;
            _urlPathPlaceholderNameAndValueFinder = urlPathPlaceholderNameAndValueFinder;

            _next = next;
        }
 public ExceptionHandlerMiddleware(OcelotRequestDelegate next,
                                   IOcelotLoggerFactory loggerFactory,
                                   IOcelotConfigurationProvider provider,
                                   IRequestScopedDataRepository repo)
 {
     _provider = provider;
     _repo     = repo;
     _next     = next;
     _logger   = loggerFactory.CreateLogger <ExceptionHandlerMiddleware>();
 }
Esempio n. 3
0
 public ExceptionHandlerMiddleware(RequestDelegate next,
                                   IOcelotLoggerFactory loggerFactory,
                                   IRequestScopedDataRepository requestScopedDataRepository,
                                   IOcelotConfigurationProvider configProvider)
     : base(requestScopedDataRepository)
 {
     _configProvider = configProvider;
     _next           = next;
     _requestScopedDataRepository = requestScopedDataRepository;
     _logger = loggerFactory.CreateLogger <ExceptionHandlerMiddleware>();
 }
        private static async Task <IOcelotConfiguration> GetOcelotConfigAndReturn(IOcelotConfigurationProvider provider)
        {
            var ocelotConfiguration = await provider.Get();

            if (ocelotConfiguration == null || ocelotConfiguration.Data == null || ocelotConfiguration.IsError)
            {
                ThrowToStopOcelotStarting(ocelotConfiguration);
            }

            return(ocelotConfiguration.Data);
        }
Esempio n. 5
0
 public DownstreamRouteFinderMiddleware(OcelotRequestDelegate next,
                                        IOcelotLoggerFactory loggerFactory,
                                        IDownstreamRouteFinder downstreamRouteFinder,
                                        IOcelotConfigurationProvider configProvider,
                                        IMultiplexer multiplexer)
 {
     _configProvider        = configProvider;
     _multiplexer           = multiplexer;
     _next                  = next;
     _downstreamRouteFinder = downstreamRouteFinder;
     _logger                = loggerFactory.CreateLogger <DownstreamRouteFinderMiddleware>();
 }
 public DownstreamRouteFinderMiddleware(RequestDelegate next,
                                        IOcelotLoggerFactory loggerFactory,
                                        IDownstreamRouteFinder downstreamRouteFinder,
                                        IRequestScopedDataRepository requestScopedDataRepository,
                                        IOcelotConfigurationProvider configProvider)
     : base(requestScopedDataRepository)
 {
     _configProvider        = configProvider;
     _next                  = next;
     _downstreamRouteFinder = downstreamRouteFinder;
     _logger                = loggerFactory.CreateLogger <DownstreamRouteFinderMiddleware>();
 }
Esempio n. 7
0
        public FilePeersProvider(IOptions <FilePeers> options, IBaseUrlFinder finder, IOcelotConfigurationProvider provider, IIdentityServerConfiguration identityServerConfig)
        {
            _identityServerConfig = identityServerConfig;
            _provider             = provider;
            _finder  = finder;
            _options = options;
            _peers   = new List <IPeer>();
            //todo - sort out async nonsense..
            var config = _provider.Get().GetAwaiter().GetResult();

            foreach (var item in _options.Value.Peers)
            {
                var httpClient = new HttpClient();
                //todo what if this errors?
                var httpPeer = new HttpPeer(item.HostAndPort, httpClient, _finder, config.Data, _identityServerConfig);
                _peers.Add(httpPeer);
            }
        }
 public OcelotConfigurationProviderTests()
 {
     _configurationRepository     = new Mock <IOcelotConfigurationRepository>();
     _ocelotConfigurationProvider = new OcelotConfigurationProvider(_configurationRepository.Object);
 }
Esempio n. 9
0
 public DownstreamRouteFinder(IOcelotConfigurationProvider configProvider, IUrlPathToUrlTemplateMatcher urlMatcher, IUrlPathPlaceholderNameAndValueFinder urlPathPlaceholderNameAndValueFinder)
 {
     _configProvider = configProvider;
     _urlMatcher     = urlMatcher;
     _urlPathPlaceholderNameAndValueFinder = urlPathPlaceholderNameAndValueFinder;
 }
Esempio n. 10
0
        private static async Task <Response> SetConfig(IApplicationBuilder builder, IOptions <FileConfiguration> fileConfiguration, IFileConfigurationSetter setter, IOcelotConfigurationProvider provider, IFileConfigurationRepository repo)
        {
            if (UsingConsul(repo))
            {
                return(await SetUpConfigFromConsul(builder, repo, setter, fileConfiguration));
            }

            return(await setter.Set(fileConfiguration.Value));
        }
Esempio n. 11
0
 public FileConfigurationProviderTests()
 {
     _creator = new Mock <IOcelotConfigurationCreator>();
     _configurationRepository     = new Mock <IOcelotConfigurationRepository>();
     _ocelotConfigurationProvider = new OcelotConfigurationProvider(_configurationRepository.Object, _creator.Object);
 }