mirror of
				https://github.com/nsnail/Ocelot.git
				synced 2025-11-04 09:15:27 +08:00 
			
		
		
		
	reorganised project so its a bit more vertical for features
This commit is contained in:
		@@ -1,7 +1,7 @@
 | 
			
		||||
namespace Ocelot.Library.Authentication
 | 
			
		||||
{
 | 
			
		||||
    using Microsoft.AspNetCore.Http;
 | 
			
		||||
using Microsoft.AspNetCore.Http;
 | 
			
		||||
 | 
			
		||||
namespace Ocelot.Library.Authentication.Handler
 | 
			
		||||
{
 | 
			
		||||
    public class AuthenticationHandler
 | 
			
		||||
    {
 | 
			
		||||
        public AuthenticationHandler(string provider, RequestDelegate handler)
 | 
			
		||||
@@ -1,9 +1,10 @@
 | 
			
		||||
namespace Ocelot.Library.Authentication
 | 
			
		||||
using IdentityServer4.AccessTokenValidation;
 | 
			
		||||
using Microsoft.AspNetCore.Builder;
 | 
			
		||||
using Microsoft.AspNetCore.Http;
 | 
			
		||||
using Ocelot.Library.Responses;
 | 
			
		||||
 | 
			
		||||
namespace Ocelot.Library.Authentication.Handler.Creator
 | 
			
		||||
{
 | 
			
		||||
    using IdentityServer4.AccessTokenValidation;
 | 
			
		||||
    using Microsoft.AspNetCore.Builder;
 | 
			
		||||
    using Microsoft.AspNetCore.Http;
 | 
			
		||||
    using Responses;
 | 
			
		||||
    using AuthenticationOptions = Configuration.AuthenticationOptions;
 | 
			
		||||
 | 
			
		||||
    /// <summary>
 | 
			
		||||
@@ -1,8 +1,9 @@
 | 
			
		||||
namespace Ocelot.Library.Authentication
 | 
			
		||||
using Microsoft.AspNetCore.Builder;
 | 
			
		||||
using Microsoft.AspNetCore.Http;
 | 
			
		||||
using Ocelot.Library.Responses;
 | 
			
		||||
 | 
			
		||||
namespace Ocelot.Library.Authentication.Handler.Creator
 | 
			
		||||
{
 | 
			
		||||
    using Microsoft.AspNetCore.Builder;
 | 
			
		||||
    using Microsoft.AspNetCore.Http;
 | 
			
		||||
    using Responses;
 | 
			
		||||
    using AuthenticationOptions = Configuration.AuthenticationOptions;
 | 
			
		||||
 | 
			
		||||
    public interface IAuthenticationHandlerCreator
 | 
			
		||||
@@ -1,9 +1,11 @@
 | 
			
		||||
namespace Ocelot.Library.Authentication
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using Microsoft.AspNetCore.Builder;
 | 
			
		||||
using Ocelot.Library.Authentication.Handler.Creator;
 | 
			
		||||
using Ocelot.Library.Errors;
 | 
			
		||||
using Ocelot.Library.Responses;
 | 
			
		||||
 | 
			
		||||
namespace Ocelot.Library.Authentication.Handler.Factory
 | 
			
		||||
{
 | 
			
		||||
    using System.Collections.Generic;
 | 
			
		||||
    using Errors;
 | 
			
		||||
    using Microsoft.AspNetCore.Builder;
 | 
			
		||||
    using Responses;
 | 
			
		||||
    using AuthenticationOptions = Configuration.AuthenticationOptions;
 | 
			
		||||
 | 
			
		||||
    public class AuthenticationHandlerFactory : IAuthenticationHandlerFactory
 | 
			
		||||
@@ -1,7 +1,8 @@
 | 
			
		||||
namespace Ocelot.Library.Authentication
 | 
			
		||||
using Microsoft.AspNetCore.Builder;
 | 
			
		||||
using Ocelot.Library.Responses;
 | 
			
		||||
 | 
			
		||||
namespace Ocelot.Library.Authentication.Handler.Factory
 | 
			
		||||
{
 | 
			
		||||
    using Microsoft.AspNetCore.Builder;
 | 
			
		||||
    using Responses;
 | 
			
		||||
    using AuthenticationOptions = Configuration.AuthenticationOptions;
 | 
			
		||||
 | 
			
		||||
    public interface IAuthenticationHandlerFactory
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
namespace Ocelot.Library.Authentication
 | 
			
		||||
{
 | 
			
		||||
    using Errors;
 | 
			
		||||
using Ocelot.Library.Errors;
 | 
			
		||||
 | 
			
		||||
namespace Ocelot.Library.Authentication.Handler.Factory
 | 
			
		||||
{
 | 
			
		||||
    public class UnableToCreateAuthenticationHandlerError : Error
 | 
			
		||||
    {
 | 
			
		||||
        public UnableToCreateAuthenticationHandlerError(string message) 
 | 
			
		||||
@@ -0,0 +1,7 @@
 | 
			
		||||
namespace Ocelot.Library.Authentication.Handler
 | 
			
		||||
{
 | 
			
		||||
    public enum SupportedAuthenticationProviders
 | 
			
		||||
    {
 | 
			
		||||
        IdentityServer
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -1,15 +1,16 @@
 | 
			
		||||
namespace Ocelot.Library.Middleware
 | 
			
		||||
{
 | 
			
		||||
    using System.Collections.Generic;
 | 
			
		||||
    using System.Threading.Tasks;
 | 
			
		||||
    using Authentication;
 | 
			
		||||
    using Configuration;
 | 
			
		||||
    using DownstreamRouteFinder;
 | 
			
		||||
    using Errors;
 | 
			
		||||
    using Microsoft.AspNetCore.Builder;
 | 
			
		||||
    using Microsoft.AspNetCore.Http;
 | 
			
		||||
    using Repository;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Threading.Tasks;
 | 
			
		||||
using Microsoft.AspNetCore.Builder;
 | 
			
		||||
using Microsoft.AspNetCore.Http;
 | 
			
		||||
using Ocelot.Library.Authentication.Handler.Factory;
 | 
			
		||||
using Ocelot.Library.Configuration;
 | 
			
		||||
using Ocelot.Library.DownstreamRouteFinder;
 | 
			
		||||
using Ocelot.Library.Errors;
 | 
			
		||||
using Ocelot.Library.Middleware;
 | 
			
		||||
using Ocelot.Library.ScopedData;
 | 
			
		||||
 | 
			
		||||
namespace Ocelot.Library.Authentication.Middleware
 | 
			
		||||
{
 | 
			
		||||
    public class AuthenticationMiddleware : OcelotMiddleware
 | 
			
		||||
    {
 | 
			
		||||
        private readonly RequestDelegate _next;
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
namespace Ocelot.Library.Middleware
 | 
			
		||||
{
 | 
			
		||||
    using Microsoft.AspNetCore.Builder;
 | 
			
		||||
using Microsoft.AspNetCore.Builder;
 | 
			
		||||
 | 
			
		||||
namespace Ocelot.Library.Authentication.Middleware
 | 
			
		||||
{
 | 
			
		||||
    public static class AuthenticationMiddlewareMiddlewareExtensions
 | 
			
		||||
    {
 | 
			
		||||
        public static IApplicationBuilder UseAuthenticationMiddleware(this IApplicationBuilder builder)
 | 
			
		||||
@@ -1,7 +0,0 @@
 | 
			
		||||
namespace Ocelot.Library.Authentication
 | 
			
		||||
{
 | 
			
		||||
    public enum SupportAuthenticationProviders
 | 
			
		||||
    {
 | 
			
		||||
        IdentityServer
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -2,13 +2,12 @@ using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using Microsoft.Extensions.Logging;
 | 
			
		||||
using Microsoft.Extensions.Options;
 | 
			
		||||
using Ocelot.Library.Configuration.Creator;
 | 
			
		||||
using Ocelot.Library.Configuration.Parser;
 | 
			
		||||
using Ocelot.Library.Configuration.Repository;
 | 
			
		||||
using Ocelot.Library.Errors;
 | 
			
		||||
using Ocelot.Library.Configuration.Validator;
 | 
			
		||||
using Ocelot.Library.Configuration.Yaml;
 | 
			
		||||
using Ocelot.Library.Responses;
 | 
			
		||||
 | 
			
		||||
namespace Ocelot.Library.Configuration.Yaml
 | 
			
		||||
namespace Ocelot.Library.Configuration.Creator
 | 
			
		||||
{
 | 
			
		||||
    /// <summary>
 | 
			
		||||
    /// Register as singleton
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
using Ocelot.Library.Errors;
 | 
			
		||||
 | 
			
		||||
namespace Ocelot.Library.RequestBuilder
 | 
			
		||||
namespace Ocelot.Library.Configuration.Parser
 | 
			
		||||
{
 | 
			
		||||
    public class InstructionNotForClaimsError : Error
 | 
			
		||||
    {
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
using Ocelot.Library.Errors;
 | 
			
		||||
 | 
			
		||||
namespace Ocelot.Library.RequestBuilder
 | 
			
		||||
namespace Ocelot.Library.Configuration.Parser
 | 
			
		||||
{
 | 
			
		||||
    public class NoInstructionsError : Error
 | 
			
		||||
    {
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
using System;
 | 
			
		||||
using Ocelot.Library.Errors;
 | 
			
		||||
 | 
			
		||||
namespace Ocelot.Library.RequestBuilder
 | 
			
		||||
namespace Ocelot.Library.Configuration.Parser
 | 
			
		||||
{
 | 
			
		||||
    public class ParsingConfigurationHeaderError : Error
 | 
			
		||||
    {
 | 
			
		||||
@@ -1,9 +1,8 @@
 | 
			
		||||
using Ocelot.Library.Configuration.Creator;
 | 
			
		||||
using Ocelot.Library.Configuration.Provider;
 | 
			
		||||
using Ocelot.Library.Configuration.Repository;
 | 
			
		||||
using Ocelot.Library.Responses;
 | 
			
		||||
 | 
			
		||||
namespace Ocelot.Library.Configuration.Yaml
 | 
			
		||||
namespace Ocelot.Library.Configuration.Provider
 | 
			
		||||
{
 | 
			
		||||
    /// <summary>
 | 
			
		||||
    /// Register as singleton
 | 
			
		||||
@@ -1,8 +1,8 @@
 | 
			
		||||
namespace Ocelot.Library.Configuration.Yaml
 | 
			
		||||
{
 | 
			
		||||
    using System.Collections.Generic;
 | 
			
		||||
    using Errors;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using Ocelot.Library.Errors;
 | 
			
		||||
 | 
			
		||||
namespace Ocelot.Library.Configuration.Validator
 | 
			
		||||
{
 | 
			
		||||
    public class ConfigurationValidationResult
 | 
			
		||||
    {
 | 
			
		||||
        public ConfigurationValidationResult(bool isError)
 | 
			
		||||
@@ -1,12 +1,14 @@
 | 
			
		||||
namespace Ocelot.Library.Configuration.Yaml
 | 
			
		||||
{
 | 
			
		||||
    using System;
 | 
			
		||||
    using System.Collections.Generic;
 | 
			
		||||
    using System.Linq;
 | 
			
		||||
    using Authentication;
 | 
			
		||||
    using Errors;
 | 
			
		||||
    using Responses;
 | 
			
		||||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Linq;
 | 
			
		||||
using Ocelot.Library.Authentication;
 | 
			
		||||
using Ocelot.Library.Authentication.Handler;
 | 
			
		||||
using Ocelot.Library.Configuration.Yaml;
 | 
			
		||||
using Ocelot.Library.Errors;
 | 
			
		||||
using Ocelot.Library.Responses;
 | 
			
		||||
 | 
			
		||||
namespace Ocelot.Library.Configuration.Validator
 | 
			
		||||
{
 | 
			
		||||
    public class ConfigurationValidator : IConfigurationValidator
 | 
			
		||||
    {
 | 
			
		||||
        public Response<ConfigurationValidationResult> IsValid(YamlConfiguration configuration)
 | 
			
		||||
@@ -57,7 +59,7 @@
 | 
			
		||||
 | 
			
		||||
        private bool IsSupportedAuthenticationProvider(string provider)
 | 
			
		||||
        {
 | 
			
		||||
            SupportAuthenticationProviders supportedProvider;
 | 
			
		||||
            SupportedAuthenticationProviders supportedProvider;
 | 
			
		||||
 | 
			
		||||
            return Enum.TryParse(provider, true, out supportedProvider);
 | 
			
		||||
        }
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
namespace Ocelot.Library.Configuration.Yaml
 | 
			
		||||
{
 | 
			
		||||
    using Errors;
 | 
			
		||||
using Ocelot.Library.Errors;
 | 
			
		||||
 | 
			
		||||
namespace Ocelot.Library.Configuration.Validator
 | 
			
		||||
{
 | 
			
		||||
    public class DownstreamTemplateAlreadyUsedError : Error
 | 
			
		||||
    {
 | 
			
		||||
        public DownstreamTemplateAlreadyUsedError(string message) : base(message, OcelotErrorCode.DownstreamTemplateAlreadyUsedError)
 | 
			
		||||
@@ -1,7 +1,8 @@
 | 
			
		||||
namespace Ocelot.Library.Configuration.Yaml
 | 
			
		||||
{
 | 
			
		||||
    using Responses;
 | 
			
		||||
using Ocelot.Library.Configuration.Yaml;
 | 
			
		||||
using Ocelot.Library.Responses;
 | 
			
		||||
 | 
			
		||||
namespace Ocelot.Library.Configuration.Validator
 | 
			
		||||
{
 | 
			
		||||
    public interface IConfigurationValidator
 | 
			
		||||
    {
 | 
			
		||||
        Response<ConfigurationValidationResult> IsValid(YamlConfiguration configuration);
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
namespace Ocelot.Library.Configuration.Yaml
 | 
			
		||||
{
 | 
			
		||||
    using Errors;
 | 
			
		||||
using Ocelot.Library.Errors;
 | 
			
		||||
 | 
			
		||||
namespace Ocelot.Library.Configuration.Validator
 | 
			
		||||
{
 | 
			
		||||
    public class UnsupportedAuthenticationProviderError : Error
 | 
			
		||||
    {
 | 
			
		||||
        public UnsupportedAuthenticationProviderError(string message) 
 | 
			
		||||
@@ -1,7 +1,17 @@
 | 
			
		||||
using Ocelot.Library.Configuration.Creator;
 | 
			
		||||
using Ocelot.Library.Authentication.Handler.Creator;
 | 
			
		||||
using Ocelot.Library.Authentication.Handler.Factory;
 | 
			
		||||
using Ocelot.Library.Configuration.Creator;
 | 
			
		||||
using Ocelot.Library.Configuration.Parser;
 | 
			
		||||
using Ocelot.Library.Configuration.Provider;
 | 
			
		||||
using Ocelot.Library.Configuration.Repository;
 | 
			
		||||
using Ocelot.Library.Configuration.Validator;
 | 
			
		||||
using Ocelot.Library.DownstreamRouteFinder.Finder;
 | 
			
		||||
using Ocelot.Library.DownstreamRouteFinder.UrlMatcher;
 | 
			
		||||
using Ocelot.Library.DownstreamUrlCreator.UrlTemplateReplacer;
 | 
			
		||||
using Ocelot.Library.HeaderBuilder;
 | 
			
		||||
using Ocelot.Library.HeaderBuilder.Parser;
 | 
			
		||||
using Ocelot.Library.RequestBuilder.Builder;
 | 
			
		||||
using Ocelot.Library.ScopedData;
 | 
			
		||||
 | 
			
		||||
namespace Ocelot.Library.DependencyInjection
 | 
			
		||||
{
 | 
			
		||||
@@ -12,12 +22,9 @@ namespace Ocelot.Library.DependencyInjection
 | 
			
		||||
    using Microsoft.AspNetCore.Http;
 | 
			
		||||
    using Microsoft.Extensions.Configuration;
 | 
			
		||||
    using Microsoft.Extensions.DependencyInjection;
 | 
			
		||||
    using Repository;
 | 
			
		||||
    using RequestBuilder;
 | 
			
		||||
    using Requester;
 | 
			
		||||
    using Responder;
 | 
			
		||||
    using UrlMatcher;
 | 
			
		||||
    using UrlTemplateReplacer;
 | 
			
		||||
 | 
			
		||||
    public static class ServiceCollectionExtensions
 | 
			
		||||
    {
 | 
			
		||||
@@ -48,7 +55,7 @@ namespace Ocelot.Library.DependencyInjection
 | 
			
		||||
            services.AddSingleton<IUrlPathToUrlTemplateMatcher, RegExUrlMatcher>();
 | 
			
		||||
            services.AddSingleton<ITemplateVariableNameAndValueFinder, TemplateVariableNameAndValueFinder>();
 | 
			
		||||
            services.AddSingleton<IDownstreamUrlTemplateVariableReplacer, DownstreamUrlTemplateVariableReplacer>();
 | 
			
		||||
            services.AddSingleton<IDownstreamRouteFinder, DownstreamRouteFinder>();
 | 
			
		||||
            services.AddSingleton<IDownstreamRouteFinder, DownstreamRouteFinder.Finder.DownstreamRouteFinder>();
 | 
			
		||||
            services.AddSingleton<IHttpRequester, HttpClientHttpRequester>();
 | 
			
		||||
            services.AddSingleton<IHttpResponder, HttpContextResponder>();
 | 
			
		||||
            services.AddSingleton<IRequestBuilder, HttpRequestBuilder>();
 | 
			
		||||
 
 | 
			
		||||
@@ -1,8 +1,9 @@
 | 
			
		||||
namespace Ocelot.Library.DownstreamRouteFinder
 | 
			
		||||
using Ocelot.Library.DownstreamRouteFinder.UrlMatcher;
 | 
			
		||||
 | 
			
		||||
namespace Ocelot.Library.DownstreamRouteFinder
 | 
			
		||||
{
 | 
			
		||||
    using System.Collections.Generic;
 | 
			
		||||
    using Configuration;
 | 
			
		||||
    using UrlMatcher;
 | 
			
		||||
 | 
			
		||||
    public class DownstreamRoute
 | 
			
		||||
    {
 | 
			
		||||
 
 | 
			
		||||
@@ -2,11 +2,11 @@
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Linq;
 | 
			
		||||
using Ocelot.Library.Configuration.Provider;
 | 
			
		||||
using Ocelot.Library.DownstreamRouteFinder.UrlMatcher;
 | 
			
		||||
using Ocelot.Library.Errors;
 | 
			
		||||
using Ocelot.Library.Responses;
 | 
			
		||||
using Ocelot.Library.UrlMatcher;
 | 
			
		||||
 | 
			
		||||
namespace Ocelot.Library.DownstreamRouteFinder
 | 
			
		||||
namespace Ocelot.Library.DownstreamRouteFinder.Finder
 | 
			
		||||
{
 | 
			
		||||
    public class DownstreamRouteFinder : IDownstreamRouteFinder
 | 
			
		||||
    {
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
namespace Ocelot.Library.DownstreamRouteFinder
 | 
			
		||||
{
 | 
			
		||||
    using Responses;
 | 
			
		||||
using Ocelot.Library.Responses;
 | 
			
		||||
 | 
			
		||||
namespace Ocelot.Library.DownstreamRouteFinder.Finder
 | 
			
		||||
{
 | 
			
		||||
    public interface IDownstreamRouteFinder
 | 
			
		||||
    {
 | 
			
		||||
        Response<DownstreamRoute> FindDownstreamRoute(string upstreamUrlPath, string upstreamHttpMethod);
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
namespace Ocelot.Library.DownstreamRouteFinder
 | 
			
		||||
{
 | 
			
		||||
    using Errors;
 | 
			
		||||
using Ocelot.Library.Errors;
 | 
			
		||||
 | 
			
		||||
namespace Ocelot.Library.DownstreamRouteFinder.Finder
 | 
			
		||||
{
 | 
			
		||||
    public class UnableToFindDownstreamRouteError : Error
 | 
			
		||||
    {
 | 
			
		||||
        public UnableToFindDownstreamRouteError() : base("UnableToFindDownstreamRouteError", OcelotErrorCode.UnableToFindDownstreamRouteError)
 | 
			
		||||
@@ -1,10 +1,11 @@
 | 
			
		||||
namespace Ocelot.Library.Middleware
 | 
			
		||||
{
 | 
			
		||||
    using System.Threading.Tasks;
 | 
			
		||||
    using DownstreamRouteFinder;
 | 
			
		||||
    using Microsoft.AspNetCore.Http;
 | 
			
		||||
    using Repository;
 | 
			
		||||
using System.Threading.Tasks;
 | 
			
		||||
using Microsoft.AspNetCore.Http;
 | 
			
		||||
using Ocelot.Library.DownstreamRouteFinder.Finder;
 | 
			
		||||
using Ocelot.Library.Middleware;
 | 
			
		||||
using Ocelot.Library.ScopedData;
 | 
			
		||||
 | 
			
		||||
namespace Ocelot.Library.DownstreamRouteFinder.Middleware
 | 
			
		||||
{
 | 
			
		||||
    public class DownstreamRouteFinderMiddleware : OcelotMiddleware
 | 
			
		||||
    {
 | 
			
		||||
        private readonly RequestDelegate _next;
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
namespace Ocelot.Library.Middleware
 | 
			
		||||
{
 | 
			
		||||
    using Microsoft.AspNetCore.Builder;
 | 
			
		||||
using Microsoft.AspNetCore.Builder;
 | 
			
		||||
 | 
			
		||||
namespace Ocelot.Library.DownstreamRouteFinder.Middleware
 | 
			
		||||
{
 | 
			
		||||
    public static class DownstreamRouteFinderMiddlewareExtensions
 | 
			
		||||
    {
 | 
			
		||||
        public static IApplicationBuilder UseDownstreamRouteFinderMiddleware(this IApplicationBuilder builder)
 | 
			
		||||
@@ -1,8 +1,8 @@
 | 
			
		||||
namespace Ocelot.Library.UrlMatcher
 | 
			
		||||
{
 | 
			
		||||
    using System.Collections.Generic;
 | 
			
		||||
    using Responses;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using Ocelot.Library.Responses;
 | 
			
		||||
 | 
			
		||||
namespace Ocelot.Library.DownstreamRouteFinder.UrlMatcher
 | 
			
		||||
{
 | 
			
		||||
    public interface ITemplateVariableNameAndValueFinder
 | 
			
		||||
    {
 | 
			
		||||
        Response<List<TemplateVariableNameAndValue>> Find(string upstreamUrlPath, string upstreamUrlPathTemplate);
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
namespace Ocelot.Library.UrlMatcher
 | 
			
		||||
{
 | 
			
		||||
    using Responses;
 | 
			
		||||
using Ocelot.Library.Responses;
 | 
			
		||||
 | 
			
		||||
namespace Ocelot.Library.DownstreamRouteFinder.UrlMatcher
 | 
			
		||||
{
 | 
			
		||||
    public interface IUrlPathToUrlTemplateMatcher
 | 
			
		||||
     {
 | 
			
		||||
        Response<UrlMatch> Match(string upstreamUrlPath, string upstreamUrlPathTemplate);
 | 
			
		||||
@@ -1,8 +1,8 @@
 | 
			
		||||
namespace Ocelot.Library.UrlMatcher
 | 
			
		||||
{
 | 
			
		||||
    using System.Text.RegularExpressions;
 | 
			
		||||
    using Responses;
 | 
			
		||||
using System.Text.RegularExpressions;
 | 
			
		||||
using Ocelot.Library.Responses;
 | 
			
		||||
 | 
			
		||||
namespace Ocelot.Library.DownstreamRouteFinder.UrlMatcher
 | 
			
		||||
{
 | 
			
		||||
    public class RegExUrlMatcher : IUrlPathToUrlTemplateMatcher
 | 
			
		||||
    {
 | 
			
		||||
        public Response<UrlMatch> Match(string upstreamUrlPath, string upstreamUrlPathTemplate)
 | 
			
		||||
@@ -1,4 +1,4 @@
 | 
			
		||||
namespace Ocelot.Library.UrlMatcher
 | 
			
		||||
namespace Ocelot.Library.DownstreamRouteFinder.UrlMatcher
 | 
			
		||||
{
 | 
			
		||||
    public class TemplateVariableNameAndValue
 | 
			
		||||
    {
 | 
			
		||||
@@ -1,8 +1,8 @@
 | 
			
		||||
namespace Ocelot.Library.UrlMatcher
 | 
			
		||||
{
 | 
			
		||||
    using System.Collections.Generic;
 | 
			
		||||
    using Responses;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using Ocelot.Library.Responses;
 | 
			
		||||
 | 
			
		||||
namespace Ocelot.Library.DownstreamRouteFinder.UrlMatcher
 | 
			
		||||
{
 | 
			
		||||
    public class TemplateVariableNameAndValueFinder : ITemplateVariableNameAndValueFinder
 | 
			
		||||
    {
 | 
			
		||||
        public Response<List<TemplateVariableNameAndValue>> Find(string upstreamUrlPath, string upstreamUrlPathTemplate)
 | 
			
		||||
@@ -1,4 +1,4 @@
 | 
			
		||||
namespace Ocelot.Library.UrlMatcher
 | 
			
		||||
namespace Ocelot.Library.DownstreamRouteFinder.UrlMatcher
 | 
			
		||||
{
 | 
			
		||||
    public class UrlMatch
 | 
			
		||||
    {
 | 
			
		||||
@@ -1,11 +1,12 @@
 | 
			
		||||
namespace Ocelot.Library.Middleware
 | 
			
		||||
{
 | 
			
		||||
    using System.Threading.Tasks;
 | 
			
		||||
    using DownstreamRouteFinder;
 | 
			
		||||
    using Microsoft.AspNetCore.Http;
 | 
			
		||||
    using Repository;
 | 
			
		||||
    using UrlTemplateReplacer;
 | 
			
		||||
using System.Threading.Tasks;
 | 
			
		||||
using Microsoft.AspNetCore.Http;
 | 
			
		||||
using Ocelot.Library.DownstreamRouteFinder;
 | 
			
		||||
using Ocelot.Library.DownstreamUrlCreator.UrlTemplateReplacer;
 | 
			
		||||
using Ocelot.Library.Middleware;
 | 
			
		||||
using Ocelot.Library.ScopedData;
 | 
			
		||||
 | 
			
		||||
namespace Ocelot.Library.DownstreamUrlCreator.Middleware
 | 
			
		||||
{
 | 
			
		||||
    public class DownstreamUrlCreatorMiddleware : OcelotMiddleware
 | 
			
		||||
    {
 | 
			
		||||
        private readonly RequestDelegate _next;
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
namespace Ocelot.Library.Middleware
 | 
			
		||||
{
 | 
			
		||||
    using Microsoft.AspNetCore.Builder;
 | 
			
		||||
using Microsoft.AspNetCore.Builder;
 | 
			
		||||
 | 
			
		||||
namespace Ocelot.Library.DownstreamUrlCreator.Middleware
 | 
			
		||||
{
 | 
			
		||||
    public static class DownstreamUrlCreatorMiddlewareExtensions
 | 
			
		||||
    {
 | 
			
		||||
        public static IApplicationBuilder UseDownstreamUrlCreatorMiddleware(this IApplicationBuilder builder)
 | 
			
		||||
@@ -1,9 +1,9 @@
 | 
			
		||||
namespace Ocelot.Library.UrlTemplateReplacer
 | 
			
		||||
{
 | 
			
		||||
    using System.Text;
 | 
			
		||||
    using DownstreamRouteFinder;
 | 
			
		||||
    using Responses;
 | 
			
		||||
using System.Text;
 | 
			
		||||
using Ocelot.Library.DownstreamRouteFinder;
 | 
			
		||||
using Ocelot.Library.Responses;
 | 
			
		||||
 | 
			
		||||
namespace Ocelot.Library.DownstreamUrlCreator.UrlTemplateReplacer
 | 
			
		||||
{
 | 
			
		||||
    public class DownstreamUrlTemplateVariableReplacer : IDownstreamUrlTemplateVariableReplacer
 | 
			
		||||
    {
 | 
			
		||||
        public Response<string> ReplaceTemplateVariables(DownstreamRoute downstreamRoute)
 | 
			
		||||
@@ -1,8 +1,8 @@
 | 
			
		||||
namespace Ocelot.Library.UrlTemplateReplacer
 | 
			
		||||
{
 | 
			
		||||
    using DownstreamRouteFinder;
 | 
			
		||||
    using Responses;
 | 
			
		||||
using Ocelot.Library.DownstreamRouteFinder;
 | 
			
		||||
using Ocelot.Library.Responses;
 | 
			
		||||
 | 
			
		||||
namespace Ocelot.Library.DownstreamUrlCreator.UrlTemplateReplacer
 | 
			
		||||
{
 | 
			
		||||
    public interface IDownstreamUrlTemplateVariableReplacer
 | 
			
		||||
    {
 | 
			
		||||
        Response<string> ReplaceTemplateVariables(DownstreamRoute downstreamRoute);   
 | 
			
		||||
@@ -3,9 +3,10 @@ using System.Linq;
 | 
			
		||||
using Microsoft.AspNetCore.Http;
 | 
			
		||||
using Microsoft.Extensions.Primitives;
 | 
			
		||||
using Ocelot.Library.Configuration;
 | 
			
		||||
using Ocelot.Library.HeaderBuilder.Parser;
 | 
			
		||||
using Ocelot.Library.Responses;
 | 
			
		||||
 | 
			
		||||
namespace Ocelot.Library.RequestBuilder
 | 
			
		||||
namespace Ocelot.Library.HeaderBuilder
 | 
			
		||||
{
 | 
			
		||||
    public class AddHeadersToRequest : IAddHeadersToRequest
 | 
			
		||||
    {
 | 
			
		||||
@@ -3,7 +3,7 @@ using Microsoft.AspNetCore.Http;
 | 
			
		||||
using Ocelot.Library.Configuration;
 | 
			
		||||
using Ocelot.Library.Responses;
 | 
			
		||||
 | 
			
		||||
namespace Ocelot.Library.RequestBuilder
 | 
			
		||||
namespace Ocelot.Library.HeaderBuilder
 | 
			
		||||
{
 | 
			
		||||
    public interface IAddHeadersToRequest
 | 
			
		||||
    {
 | 
			
		||||
@@ -1,15 +1,12 @@
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Linq;
 | 
			
		||||
using Microsoft.Extensions.Primitives;
 | 
			
		||||
using System.Linq;
 | 
			
		||||
using System.Threading.Tasks;
 | 
			
		||||
using Microsoft.AspNetCore.Http;
 | 
			
		||||
using Ocelot.Library.DownstreamRouteFinder;
 | 
			
		||||
using Ocelot.Library.RequestBuilder;
 | 
			
		||||
using Ocelot.Library.Middleware;
 | 
			
		||||
using Ocelot.Library.ScopedData;
 | 
			
		||||
 | 
			
		||||
namespace Ocelot.Library.Middleware
 | 
			
		||||
namespace Ocelot.Library.HeaderBuilder.Middleware
 | 
			
		||||
{
 | 
			
		||||
    using System.Threading.Tasks;
 | 
			
		||||
    using Microsoft.AspNetCore.Http;
 | 
			
		||||
    using Repository;
 | 
			
		||||
 | 
			
		||||
    public class HttpRequestHeadersBuilderMiddleware : OcelotMiddleware
 | 
			
		||||
    {
 | 
			
		||||
        private readonly RequestDelegate _next;
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
namespace Ocelot.Library.Middleware
 | 
			
		||||
{
 | 
			
		||||
    using Microsoft.AspNetCore.Builder;
 | 
			
		||||
using Microsoft.AspNetCore.Builder;
 | 
			
		||||
 | 
			
		||||
namespace Ocelot.Library.HeaderBuilder.Middleware
 | 
			
		||||
{
 | 
			
		||||
    public static class HttpRequestHeadersBuilderMiddlewareExtensions
 | 
			
		||||
    {
 | 
			
		||||
        public static IApplicationBuilder UseHttpRequestHeadersBuilderMiddleware(this IApplicationBuilder builder)
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
using Ocelot.Library.Errors;
 | 
			
		||||
 | 
			
		||||
namespace Ocelot.Library.RequestBuilder
 | 
			
		||||
namespace Ocelot.Library.HeaderBuilder.Parser
 | 
			
		||||
{
 | 
			
		||||
    public class CannotFindClaimError : Error
 | 
			
		||||
    {
 | 
			
		||||
@@ -4,7 +4,7 @@ using System.Security.Claims;
 | 
			
		||||
using Ocelot.Library.Errors;
 | 
			
		||||
using Ocelot.Library.Responses;
 | 
			
		||||
 | 
			
		||||
namespace Ocelot.Library.RequestBuilder
 | 
			
		||||
namespace Ocelot.Library.HeaderBuilder.Parser
 | 
			
		||||
{
 | 
			
		||||
    public class ClaimsParser : IClaimsParser
 | 
			
		||||
    {
 | 
			
		||||
@@ -2,7 +2,7 @@
 | 
			
		||||
using System.Security.Claims;
 | 
			
		||||
using Ocelot.Library.Responses;
 | 
			
		||||
 | 
			
		||||
namespace Ocelot.Library.RequestBuilder
 | 
			
		||||
namespace Ocelot.Library.HeaderBuilder.Parser
 | 
			
		||||
{
 | 
			
		||||
    public interface IClaimsParser
 | 
			
		||||
    {
 | 
			
		||||
@@ -1,8 +1,9 @@
 | 
			
		||||
namespace Ocelot.Library.Middleware
 | 
			
		||||
using Ocelot.Library.ScopedData;
 | 
			
		||||
 | 
			
		||||
namespace Ocelot.Library.Middleware
 | 
			
		||||
{
 | 
			
		||||
    using System.Collections.Generic;
 | 
			
		||||
    using Errors;
 | 
			
		||||
    using Repository;
 | 
			
		||||
 | 
			
		||||
    public abstract class OcelotMiddleware
 | 
			
		||||
    {
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,12 @@
 | 
			
		||||
namespace Ocelot.Library.Middleware
 | 
			
		||||
using Ocelot.Library.Authentication.Middleware;
 | 
			
		||||
using Ocelot.Library.DownstreamRouteFinder.Middleware;
 | 
			
		||||
using Ocelot.Library.DownstreamUrlCreator.Middleware;
 | 
			
		||||
using Ocelot.Library.HeaderBuilder.Middleware;
 | 
			
		||||
using Ocelot.Library.RequestBuilder.Middleware;
 | 
			
		||||
using Ocelot.Library.Requester.Middleware;
 | 
			
		||||
using Ocelot.Library.Responder.Middleware;
 | 
			
		||||
 | 
			
		||||
namespace Ocelot.Library.Middleware
 | 
			
		||||
{
 | 
			
		||||
    using Microsoft.AspNetCore.Builder;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,14 +1,14 @@
 | 
			
		||||
namespace Ocelot.Library.RequestBuilder
 | 
			
		||||
{
 | 
			
		||||
    using System;
 | 
			
		||||
    using System.IO;
 | 
			
		||||
    using System.Net;
 | 
			
		||||
    using System.Net.Http;
 | 
			
		||||
    using System.Net.Http.Headers;
 | 
			
		||||
    using System.Threading.Tasks;
 | 
			
		||||
    using Microsoft.AspNetCore.Http;
 | 
			
		||||
    using Responses;
 | 
			
		||||
using System;
 | 
			
		||||
using System.IO;
 | 
			
		||||
using System.Net;
 | 
			
		||||
using System.Net.Http;
 | 
			
		||||
using System.Net.Http.Headers;
 | 
			
		||||
using System.Threading.Tasks;
 | 
			
		||||
using Microsoft.AspNetCore.Http;
 | 
			
		||||
using Ocelot.Library.Responses;
 | 
			
		||||
 | 
			
		||||
namespace Ocelot.Library.RequestBuilder.Builder
 | 
			
		||||
{
 | 
			
		||||
    public class HttpRequestBuilder : IRequestBuilder
 | 
			
		||||
    {
 | 
			
		||||
        public async Task<Response<Request>> Build(string httpMethod, string downstreamUrl, Stream content, IHeaderDictionary headers,
 | 
			
		||||
@@ -1,10 +1,10 @@
 | 
			
		||||
namespace Ocelot.Library.RequestBuilder
 | 
			
		||||
{
 | 
			
		||||
    using System.IO;
 | 
			
		||||
    using System.Threading.Tasks;
 | 
			
		||||
    using Microsoft.AspNetCore.Http;
 | 
			
		||||
    using Responses;
 | 
			
		||||
using System.IO;
 | 
			
		||||
using System.Threading.Tasks;
 | 
			
		||||
using Microsoft.AspNetCore.Http;
 | 
			
		||||
using Ocelot.Library.Responses;
 | 
			
		||||
 | 
			
		||||
namespace Ocelot.Library.RequestBuilder.Builder
 | 
			
		||||
{
 | 
			
		||||
    public interface IRequestBuilder
 | 
			
		||||
    {
 | 
			
		||||
        Task<Response<Request>> Build(string httpMethod,
 | 
			
		||||
@@ -1,10 +1,11 @@
 | 
			
		||||
namespace Ocelot.Library.Middleware
 | 
			
		||||
{
 | 
			
		||||
    using System.Threading.Tasks;
 | 
			
		||||
    using Microsoft.AspNetCore.Http;
 | 
			
		||||
    using Repository;
 | 
			
		||||
    using RequestBuilder;
 | 
			
		||||
using System.Threading.Tasks;
 | 
			
		||||
using Microsoft.AspNetCore.Http;
 | 
			
		||||
using Ocelot.Library.Middleware;
 | 
			
		||||
using Ocelot.Library.RequestBuilder.Builder;
 | 
			
		||||
using Ocelot.Library.ScopedData;
 | 
			
		||||
 | 
			
		||||
namespace Ocelot.Library.RequestBuilder.Middleware
 | 
			
		||||
{
 | 
			
		||||
    public class HttpRequestBuilderMiddleware : OcelotMiddleware
 | 
			
		||||
    {
 | 
			
		||||
        private readonly RequestDelegate _next;
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
namespace Ocelot.Library.Middleware
 | 
			
		||||
{
 | 
			
		||||
    using Microsoft.AspNetCore.Builder;
 | 
			
		||||
using Microsoft.AspNetCore.Builder;
 | 
			
		||||
 | 
			
		||||
namespace Ocelot.Library.RequestBuilder.Middleware
 | 
			
		||||
{
 | 
			
		||||
    public static class HttpRequestBuilderMiddlewareExtensions
 | 
			
		||||
    {
 | 
			
		||||
        public static IApplicationBuilder UseHttpRequestBuilderMiddleware(this IApplicationBuilder builder)
 | 
			
		||||
@@ -1,11 +1,11 @@
 | 
			
		||||
namespace Ocelot.Library.Middleware
 | 
			
		||||
{
 | 
			
		||||
    using System.Threading.Tasks;
 | 
			
		||||
    using Microsoft.AspNetCore.Http;
 | 
			
		||||
    using Repository;
 | 
			
		||||
    using RequestBuilder;
 | 
			
		||||
    using Requester;
 | 
			
		||||
using System.Threading.Tasks;
 | 
			
		||||
using Microsoft.AspNetCore.Http;
 | 
			
		||||
using Ocelot.Library.Middleware;
 | 
			
		||||
using Ocelot.Library.RequestBuilder;
 | 
			
		||||
using Ocelot.Library.ScopedData;
 | 
			
		||||
 | 
			
		||||
namespace Ocelot.Library.Requester.Middleware
 | 
			
		||||
{
 | 
			
		||||
    public class HttpRequesterMiddleware : OcelotMiddleware
 | 
			
		||||
    {
 | 
			
		||||
        private readonly RequestDelegate _next;
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
namespace Ocelot.Library.Middleware
 | 
			
		||||
{
 | 
			
		||||
    using Microsoft.AspNetCore.Builder;
 | 
			
		||||
using Microsoft.AspNetCore.Builder;
 | 
			
		||||
 | 
			
		||||
namespace Ocelot.Library.Requester.Middleware
 | 
			
		||||
{
 | 
			
		||||
    public static class HttpRequesterMiddlewareExtensions
 | 
			
		||||
    {
 | 
			
		||||
        public static IApplicationBuilder UseHttpRequesterMiddleware(this IApplicationBuilder builder)
 | 
			
		||||
@@ -1,11 +1,11 @@
 | 
			
		||||
namespace Ocelot.Library.Middleware
 | 
			
		||||
{
 | 
			
		||||
    using System.Net.Http;
 | 
			
		||||
    using System.Threading.Tasks;
 | 
			
		||||
    using Microsoft.AspNetCore.Http;
 | 
			
		||||
    using Repository;
 | 
			
		||||
    using Responder;
 | 
			
		||||
using System.Net.Http;
 | 
			
		||||
using System.Threading.Tasks;
 | 
			
		||||
using Microsoft.AspNetCore.Http;
 | 
			
		||||
using Ocelot.Library.Middleware;
 | 
			
		||||
using Ocelot.Library.ScopedData;
 | 
			
		||||
 | 
			
		||||
namespace Ocelot.Library.Responder.Middleware
 | 
			
		||||
{
 | 
			
		||||
    public class HttpResponderMiddleware : OcelotMiddleware
 | 
			
		||||
    {
 | 
			
		||||
        private readonly RequestDelegate _next;
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
namespace Ocelot.Library.Middleware
 | 
			
		||||
{
 | 
			
		||||
    using Microsoft.AspNetCore.Builder;
 | 
			
		||||
using Microsoft.AspNetCore.Builder;
 | 
			
		||||
 | 
			
		||||
namespace Ocelot.Library.Responder.Middleware
 | 
			
		||||
{
 | 
			
		||||
    public static class HttpResponderMiddlewareExtensions
 | 
			
		||||
    {
 | 
			
		||||
        public static IApplicationBuilder UseHttpResponderMiddleware(this IApplicationBuilder builder)
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
namespace Ocelot.Library.Repository
 | 
			
		||||
{
 | 
			
		||||
    using Errors;
 | 
			
		||||
using Ocelot.Library.Errors;
 | 
			
		||||
 | 
			
		||||
namespace Ocelot.Library.ScopedData
 | 
			
		||||
{
 | 
			
		||||
    public class CannotAddDataError : Error
 | 
			
		||||
    {
 | 
			
		||||
        public CannotAddDataError(string message) : base(message, OcelotErrorCode.CannotAddDataError)
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
namespace Ocelot.Library.Repository
 | 
			
		||||
{
 | 
			
		||||
    using Errors;
 | 
			
		||||
using Ocelot.Library.Errors;
 | 
			
		||||
 | 
			
		||||
namespace Ocelot.Library.ScopedData
 | 
			
		||||
{
 | 
			
		||||
    public class CannotFindDataError : Error
 | 
			
		||||
    {
 | 
			
		||||
        public CannotFindDataError(string message) : base(message, OcelotErrorCode.CannotFindDataError)
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
namespace Ocelot.Library.Repository
 | 
			
		||||
{
 | 
			
		||||
    using Responses;
 | 
			
		||||
using Ocelot.Library.Responses;
 | 
			
		||||
 | 
			
		||||
namespace Ocelot.Library.ScopedData
 | 
			
		||||
{
 | 
			
		||||
    public interface IScopedRequestDataRepository
 | 
			
		||||
    {
 | 
			
		||||
        Response Add<T>(string key, T value);
 | 
			
		||||
@@ -1,11 +1,11 @@
 | 
			
		||||
namespace Ocelot.Library.Repository
 | 
			
		||||
{
 | 
			
		||||
    using System;
 | 
			
		||||
    using System.Collections.Generic;
 | 
			
		||||
    using Errors;
 | 
			
		||||
    using Microsoft.AspNetCore.Http;
 | 
			
		||||
    using Responses;
 | 
			
		||||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using Microsoft.AspNetCore.Http;
 | 
			
		||||
using Ocelot.Library.Errors;
 | 
			
		||||
using Ocelot.Library.Responses;
 | 
			
		||||
 | 
			
		||||
namespace Ocelot.Library.ScopedData
 | 
			
		||||
{
 | 
			
		||||
    public class ScopedRequestDataRepository : IScopedRequestDataRepository
 | 
			
		||||
    {
 | 
			
		||||
        private readonly IHttpContextAccessor _httpContextAccessor;
 | 
			
		||||
		Reference in New Issue
	
	Block a user