public ExceptionHandlerMiddleware(OcelotRequestDelegate next, IOcelotLoggerFactory loggerFactory, IInternalConfigurationRepository configRepo, IRequestScopedDataRepository repo) : base(loggerFactory.CreateLogger <ExceptionHandlerMiddleware>()) { _configRepo = configRepo; _repo = repo; _next = next; }
public DiffClientRateLimitMiddleware(OcelotRequestDelegate next, IOcelotLoggerFactory loggerFactory, IClientRateLimitProcessor clientRateLimitProcessor, CusOcelotConfiguration options) : base(loggerFactory.CreateLogger <DiffClientRateLimitMiddleware>()) { _next = next; _clientRateLimitProcessor = clientRateLimitProcessor; _options = options; }
public HttpHeadersTransformationMiddleware(OcelotRequestDelegate next, IOcelotLoggerFactory loggerFactory, IHttpContextRequestHeaderReplacer preReplacer, IHttpResponseHeaderReplacer postReplacer) { _next = next; _postReplacer = postReplacer; _preReplacer = preReplacer; _logger = loggerFactory.CreateLogger <HttpHeadersTransformationMiddleware>(); }
public OutputCacheMiddleware(OcelotRequestDelegate next, IOcelotLoggerFactory loggerFactory, IOcelotCache <CachedResponse> outputCache, ICacheKeyGenerator cacheGeneratot) : base(loggerFactory.CreateLogger <OutputCacheMiddleware>()) { _next = next; _outputCache = outputCache; _cacheGeneratot = cacheGeneratot; }
public ClaimsToClaimsMiddlewareTests() { _addHeaders = new Mock <IAddClaimsToRequest>(); _downstreamContext = new DownstreamContext(new DefaultHttpContext()); _loggerFactory = new Mock <IOcelotLoggerFactory>(); _logger = new Mock <IOcelotLogger>(); _loggerFactory.Setup(x => x.CreateLogger <ClaimsToClaimsMiddleware>()).Returns(_logger.Object); _next = context => Task.CompletedTask; _middleware = new ClaimsToClaimsMiddleware(_next, _loggerFactory.Object, _addHeaders.Object); }
public DotNettyHttpMiddleware( OcelotRequestDelegate next, IDotNettyRequestBuilder dotNettyRequestBuilder, IServiceProxyProvider serviceProxyProvider, IOcelotLoggerFactory factory) : base(factory.CreateLogger <DotNettyHttpMiddleware>()) { _next = next; _dotNettyRequestBuilder = dotNettyRequestBuilder; _serviceProxyProvider = serviceProxyProvider; }
public TokenRefreshMiddleware(OcelotRequestDelegate next, IOcelotLoggerFactory loggerFactory, ICustomTokenRefreshService refreshService, OcelotConfiguration options) : base(loggerFactory.CreateLogger <AuthenticaitonMiddleware>()) { _next = next; _options = options; _tokenRefreshService = refreshService; }
public DownstreamUrlCreatorMiddlewareTests() { _downstreamContext = new DownstreamContext(new DefaultHttpContext()); _loggerFactory = new Mock <IOcelotLoggerFactory>(); _logger = new Mock <IOcelotLogger>(); _loggerFactory.Setup(x => x.CreateLogger <DownstreamUrlCreatorMiddleware>()).Returns(_logger.Object); _downstreamUrlTemplateVariableReplacer = new Mock <IDownstreamPathPlaceholderReplacer>(); _downstreamContext.DownstreamRequest = new HttpRequestMessage(HttpMethod.Get, "https://my.url/abc/?q=123"); _next = context => Task.CompletedTask; }
public ExceptionHandlerMiddleware(OcelotRequestDelegate next, IOcelotLoggerFactory loggerFactory, IOcelotConfigurationProvider provider, IRequestScopedDataRepository repo) : base(loggerFactory.CreateLogger <ExceptionHandlerMiddleware>()) { _provider = provider; _repo = repo; _next = next; }
public DownstreamRequestInitialiserMiddleware(OcelotRequestDelegate next, IOcelotLoggerFactory loggerFactory, Mapper.IRequestMapper requestMapper, IDownstreamRequestCreator creator) : base(loggerFactory.CreateLogger <DownstreamRequestInitialiserMiddleware>()) { _next = next; _requestMapper = requestMapper; _creator = creator; }
public AuthorisationMiddleware(OcelotRequestDelegate next, IClaimsAuthoriser claimsAuthoriser, IScopesAuthoriser scopesAuthoriser, IOcelotLoggerFactory loggerFactory) { _next = next; _claimsAuthoriser = claimsAuthoriser; _scopesAuthoriser = scopesAuthoriser; _logger = loggerFactory.CreateLogger <AuthorisationMiddleware>(); }
public DownstreamRouteFinderMiddleware(OcelotRequestDelegate next, IOcelotLoggerFactory loggerFactory, IDownstreamRouteProviderFactory downstreamRouteFinder, IMultiplexer multiplexer) : base(loggerFactory.CreateLogger <DownstreamRouteFinderMiddleware>()) { _multiplexer = multiplexer; _next = next; _factory = downstreamRouteFinder; }
public OutputCacheMiddleware(OcelotRequestDelegate next, IOcelotLoggerFactory loggerFactory, IOcelotCache <CachedResponse> outputCache, IRegionCreator regionCreator) { _next = next; _outputCache = outputCache; _logger = loggerFactory.CreateLogger <OutputCacheMiddleware>(); _regionCreator = regionCreator; }
public AhphAuthenticationMiddleware(OcelotRequestDelegate next, IOcelotLoggerFactory loggerFactory, IAhphAuthenticationProcessor ahphAuthenticationProcessor, AhphOcelotConfiguration options) : base(loggerFactory.CreateLogger <AhphAuthenticationMiddleware>()) { _next = next; _ahphAuthenticationProcessor = ahphAuthenticationProcessor; _options = options; }
public HttpRequesterMiddlewareTests() { _requester = new Mock <IHttpRequester>(); _loggerFactory = new Mock <IOcelotLoggerFactory>(); _logger = new Mock <IOcelotLogger>(); _loggerFactory.Setup(x => x.CreateLogger <HttpRequesterMiddleware>()).Returns(_logger.Object); _next = async context => { //do nothing }; _middleware = new HttpRequesterMiddleware(_next, _loggerFactory.Object, _requester.Object); }
public ClaimsToDownstreamPathMiddlewareTests() { _downstreamContext = new DownstreamContext(new DefaultHttpContext()); _loggerFactory = new Mock <IOcelotLoggerFactory>(); _logger = new Mock <IOcelotLogger>(); _loggerFactory.Setup(x => x.CreateLogger <ClaimsToDownstreamPathMiddleware>()).Returns(_logger.Object); _next = context => Task.CompletedTask; _changePath = new Mock <IChangeDownstreamPathTemplate>(); _downstreamContext.DownstreamRequest = new DownstreamRequest(new HttpRequestMessage(HttpMethod.Get, "http://test.com")); _middleware = new ClaimsToDownstreamPathMiddleware(_next, _loggerFactory.Object, _changePath.Object); }
public ResponderMiddleware(OcelotRequestDelegate next, IHttpResponder responder, IOcelotLoggerFactory loggerFactory, IErrorsToHttpStatusCodeMapper codeMapper ) : base(loggerFactory.CreateLogger <ResponderMiddleware>()) { _next = next; _responder = responder; _codeMapper = codeMapper; }
private void WhenICallTheMiddleware() { _next = (context) => { byte[] byteArray = Encoding.ASCII.GetBytes("The user is authenticated"); var stream = new MemoryStream(byteArray); context.HttpContext.Response.Body = stream; return(Task.CompletedTask); }; _middleware = new AuthenticationMiddleware(_next, _factory.Object); _middleware.Invoke(_downstreamContext).GetAwaiter().GetResult(); }
public GrpcHttpMiddleware(OcelotRequestDelegate next, IGrpcChannelFactory grpcChannelFactory, IGrpcServiceDescriptor grpcServiceDescriptor, IGrpcRequestBuilder grpcRequestBuilder, IOcelotLoggerFactory factory) : base(factory.CreateLogger <GrpcHttpMiddleware>()) { this.next = next; this.grpcChannelFactory = grpcChannelFactory; this.grpcServiceDescriptor = grpcServiceDescriptor; this.grpcRequestBuilder = grpcRequestBuilder; }
public OutputCacheMiddlewareTests() { _cache = new Mock <IOcelotCache <CachedResponse> >(); _downstreamContext = new DownstreamContext(new DefaultHttpContext()); _loggerFactory = new Mock <IOcelotLoggerFactory>(); _logger = new Mock <IOcelotLogger>(); _cacheKeyGenerator = new CacheKeyGenerator(); _loggerFactory.Setup(x => x.CreateLogger <OutputCacheMiddleware>()).Returns(_logger.Object); _next = context => Task.CompletedTask; _downstreamContext.DownstreamRequest = new Ocelot.Request.Middleware.DownstreamRequest(new HttpRequestMessage(HttpMethod.Get, "https://some.url/blah?abcd=123")); }
public ResponderMiddlewareTests() { _responder = new Mock <IHttpResponder>(); _codeMapper = new Mock <IErrorsToHttpStatusCodeMapper>(); _downstreamContext = new DownstreamContext(new DefaultHttpContext()); _loggerFactory = new Mock <IOcelotLoggerFactory>(); _logger = new Mock <IOcelotLogger>(); _loggerFactory.Setup(x => x.CreateLogger <ResponderMiddleware>()).Returns(_logger.Object); _next = context => Task.CompletedTask; _middleware = new ResponderMiddleware(_next, _responder.Object, _loggerFactory.Object, _codeMapper.Object); }
public ClaimsToQueryStringMiddlewareTests() { _downstreamContext = new DownstreamContext(new DefaultHttpContext()); _loggerFactory = new Mock <IOcelotLoggerFactory>(); _logger = new Mock <IOcelotLogger>(); _loggerFactory.Setup(x => x.CreateLogger <ClaimsToQueryStringMiddleware>()).Returns(_logger.Object); _next = context => Task.CompletedTask; _addQueries = new Mock <IAddQueriesToRequest>(); _downstreamContext.DownstreamRequest = new DownstreamRequest(new HttpRequestMessage(HttpMethod.Get, "http://test.com")); _middleware = new ClaimsToQueryStringMiddleware(_next, _loggerFactory.Object, _addQueries.Object); }
public AuthorisationMiddlewareTests() { _authService = new Mock <IClaimsAuthoriser>(); _authScopesService = new Mock <IScopesAuthoriser>(); _downstreamContext = new DownstreamContext(new DefaultHttpContext()); _loggerFactory = new Mock <IOcelotLoggerFactory>(); _logger = new Mock <IOcelotLogger>(); _loggerFactory.Setup(x => x.CreateLogger <AuthorisationMiddleware>()).Returns(_logger.Object); _next = context => Task.CompletedTask; _middleware = new AuthorisationMiddleware(_next, _authService.Object, _authScopesService.Object, _loggerFactory.Object); }
public QueryStringBuilderMiddlewareTests() { _downstreamContext = new DownstreamContext(new DefaultHttpContext()); _loggerFactory = new Mock <IOcelotLoggerFactory>(); _logger = new Mock <IOcelotLogger>(); _loggerFactory.Setup(x => x.CreateLogger <QueryStringBuilderMiddleware>()).Returns(_logger.Object); _next = context => Task.CompletedTask; _addQueries = new Mock <IAddQueriesToRequest>(); _downstreamContext.DownstreamRequest = new HttpRequestMessage(); _middleware = new QueryStringBuilderMiddleware(_next, _loggerFactory.Object, _addQueries.Object); }
public HttpHeadersTransformationMiddlewareTests() { _preReplacer = new Mock <IHttpContextRequestHeaderReplacer>(); _postReplacer = new Mock <IHttpResponseHeaderReplacer>(); _downstreamContext = new DownstreamContext(new DefaultHttpContext()); _loggerFactory = new Mock <IOcelotLoggerFactory>(); _logger = new Mock <IOcelotLogger>(); _loggerFactory.Setup(x => x.CreateLogger <AuthorisationMiddleware>()).Returns(_logger.Object); _next = context => Task.CompletedTask; _middleware = new HttpHeadersTransformationMiddleware(_next, _loggerFactory.Object, _preReplacer.Object, _postReplacer.Object); }
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 DownstreamRouteFinderMiddlewareTests() { _repo = new Mock <IInternalConfigurationRepository>(); _finder = new Mock <IDownstreamRouteFinder>(); _downstreamContext = new DownstreamContext(new DefaultHttpContext()); _loggerFactory = new Mock <IOcelotLoggerFactory>(); _logger = new Mock <IOcelotLogger>(); _loggerFactory.Setup(x => x.CreateLogger <DownstreamRouteFinderMiddleware>()).Returns(_logger.Object); _next = context => Task.CompletedTask; _multiplexer = new Mock <IMultiplexer>(); _middleware = new DownstreamRouteFinderMiddleware(_next, _loggerFactory.Object, _finder.Object, _repo.Object, _multiplexer.Object); }
public ClaimsBuilderMiddlewareTests() { _addHeaders = new Mock <IAddClaimsToRequest>(); _downstreamContext = new DownstreamContext(new DefaultHttpContext()); _loggerFactory = new Mock <IOcelotLoggerFactory>(); _logger = new Mock <IOcelotLogger>(); _loggerFactory.Setup(x => x.CreateLogger <ClaimsBuilderMiddleware>()).Returns(_logger.Object); _next = async context => { //do nothing }; _middleware = new ClaimsBuilderMiddleware(_next, _loggerFactory.Object, _addHeaders.Object); }
public DownstreamRouteFinderMiddleware(OcelotRequestDelegate next, IOcelotLoggerFactory loggerFactory, IDownstreamRouteFinder downstreamRouteFinder, IInternalConfigurationRepository repo, IMultiplexer multiplexer) : base(loggerFactory.CreateLogger <DownstreamRouteFinderMiddleware>()) { _repo = repo; _multiplexer = multiplexer; _next = next; _downstreamRouteFinder = downstreamRouteFinder; }
public LoadBalancerMiddlewareTests() { _loadBalancerHouse = new Mock <ILoadBalancerHouse>(); _loadBalancer = new Mock <ILoadBalancer>(); _loadBalancerHouse = new Mock <ILoadBalancerHouse>(); _downstreamRequest = new HttpRequestMessage(HttpMethod.Get, "http://test.com/"); _downstreamContext = new DownstreamContext(new DefaultHttpContext()); _loggerFactory = new Mock <IOcelotLoggerFactory>(); _logger = new Mock <IOcelotLogger>(); _loggerFactory.Setup(x => x.CreateLogger <LoadBalancingMiddleware>()).Returns(_logger.Object); _next = context => Task.CompletedTask; _downstreamContext.DownstreamRequest = new DownstreamRequest(_downstreamRequest); }