mirror of
https://github.com/nsnail/Ocelot.git
synced 2025-04-22 06:22:50 +08:00
reorganised project so its a bit more vertical for features
This commit is contained in:
parent
2e6640c6ef
commit
f79b76b414
@ -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 class AuthenticationHandler
|
||||||
{
|
{
|
||||||
public AuthenticationHandler(string provider, RequestDelegate handler)
|
public AuthenticationHandler(string provider, RequestDelegate handler)
|
@ -1,9 +1,10 @@
|
|||||||
namespace Ocelot.Library.Authentication
|
|
||||||
{
|
|
||||||
using IdentityServer4.AccessTokenValidation;
|
using IdentityServer4.AccessTokenValidation;
|
||||||
using Microsoft.AspNetCore.Builder;
|
using Microsoft.AspNetCore.Builder;
|
||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
using Responses;
|
using Ocelot.Library.Responses;
|
||||||
|
|
||||||
|
namespace Ocelot.Library.Authentication.Handler.Creator
|
||||||
|
{
|
||||||
using AuthenticationOptions = Configuration.AuthenticationOptions;
|
using AuthenticationOptions = Configuration.AuthenticationOptions;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
@ -1,8 +1,9 @@
|
|||||||
namespace Ocelot.Library.Authentication
|
using Microsoft.AspNetCore.Builder;
|
||||||
{
|
|
||||||
using Microsoft.AspNetCore.Builder;
|
|
||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
using Responses;
|
using Ocelot.Library.Responses;
|
||||||
|
|
||||||
|
namespace Ocelot.Library.Authentication.Handler.Creator
|
||||||
|
{
|
||||||
using AuthenticationOptions = Configuration.AuthenticationOptions;
|
using AuthenticationOptions = Configuration.AuthenticationOptions;
|
||||||
|
|
||||||
public interface IAuthenticationHandlerCreator
|
public interface IAuthenticationHandlerCreator
|
@ -1,9 +1,11 @@
|
|||||||
namespace Ocelot.Library.Authentication
|
|
||||||
{
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Errors;
|
|
||||||
using Microsoft.AspNetCore.Builder;
|
using Microsoft.AspNetCore.Builder;
|
||||||
using Responses;
|
using Ocelot.Library.Authentication.Handler.Creator;
|
||||||
|
using Ocelot.Library.Errors;
|
||||||
|
using Ocelot.Library.Responses;
|
||||||
|
|
||||||
|
namespace Ocelot.Library.Authentication.Handler.Factory
|
||||||
|
{
|
||||||
using AuthenticationOptions = Configuration.AuthenticationOptions;
|
using AuthenticationOptions = Configuration.AuthenticationOptions;
|
||||||
|
|
||||||
public class AuthenticationHandlerFactory : IAuthenticationHandlerFactory
|
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;
|
using AuthenticationOptions = Configuration.AuthenticationOptions;
|
||||||
|
|
||||||
public interface IAuthenticationHandlerFactory
|
public interface IAuthenticationHandlerFactory
|
@ -1,7 +1,7 @@
|
|||||||
namespace Ocelot.Library.Authentication
|
using Ocelot.Library.Errors;
|
||||||
{
|
|
||||||
using Errors;
|
|
||||||
|
|
||||||
|
namespace Ocelot.Library.Authentication.Handler.Factory
|
||||||
|
{
|
||||||
public class UnableToCreateAuthenticationHandlerError : Error
|
public class UnableToCreateAuthenticationHandlerError : Error
|
||||||
{
|
{
|
||||||
public UnableToCreateAuthenticationHandlerError(string message)
|
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.Collections.Generic;
|
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Authentication;
|
|
||||||
using Configuration;
|
|
||||||
using DownstreamRouteFinder;
|
|
||||||
using Errors;
|
|
||||||
using Microsoft.AspNetCore.Builder;
|
using Microsoft.AspNetCore.Builder;
|
||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
using Repository;
|
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
|
public class AuthenticationMiddleware : OcelotMiddleware
|
||||||
{
|
{
|
||||||
private readonly RequestDelegate _next;
|
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 class AuthenticationMiddlewareMiddlewareExtensions
|
||||||
{
|
{
|
||||||
public static IApplicationBuilder UseAuthenticationMiddleware(this IApplicationBuilder builder)
|
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 System.Collections.Generic;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using Microsoft.Extensions.Options;
|
using Microsoft.Extensions.Options;
|
||||||
using Ocelot.Library.Configuration.Creator;
|
|
||||||
using Ocelot.Library.Configuration.Parser;
|
using Ocelot.Library.Configuration.Parser;
|
||||||
using Ocelot.Library.Configuration.Repository;
|
using Ocelot.Library.Configuration.Validator;
|
||||||
using Ocelot.Library.Errors;
|
using Ocelot.Library.Configuration.Yaml;
|
||||||
using Ocelot.Library.Responses;
|
using Ocelot.Library.Responses;
|
||||||
|
|
||||||
namespace Ocelot.Library.Configuration.Yaml
|
namespace Ocelot.Library.Configuration.Creator
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Register as singleton
|
/// Register as singleton
|
@ -1,6 +1,6 @@
|
|||||||
using Ocelot.Library.Errors;
|
using Ocelot.Library.Errors;
|
||||||
|
|
||||||
namespace Ocelot.Library.RequestBuilder
|
namespace Ocelot.Library.Configuration.Parser
|
||||||
{
|
{
|
||||||
public class InstructionNotForClaimsError : Error
|
public class InstructionNotForClaimsError : Error
|
||||||
{
|
{
|
@ -1,6 +1,6 @@
|
|||||||
using Ocelot.Library.Errors;
|
using Ocelot.Library.Errors;
|
||||||
|
|
||||||
namespace Ocelot.Library.RequestBuilder
|
namespace Ocelot.Library.Configuration.Parser
|
||||||
{
|
{
|
||||||
public class NoInstructionsError : Error
|
public class NoInstructionsError : Error
|
||||||
{
|
{
|
@ -1,7 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using Ocelot.Library.Errors;
|
using Ocelot.Library.Errors;
|
||||||
|
|
||||||
namespace Ocelot.Library.RequestBuilder
|
namespace Ocelot.Library.Configuration.Parser
|
||||||
{
|
{
|
||||||
public class ParsingConfigurationHeaderError : Error
|
public class ParsingConfigurationHeaderError : Error
|
||||||
{
|
{
|
@ -1,9 +1,8 @@
|
|||||||
using Ocelot.Library.Configuration.Creator;
|
using Ocelot.Library.Configuration.Creator;
|
||||||
using Ocelot.Library.Configuration.Provider;
|
|
||||||
using Ocelot.Library.Configuration.Repository;
|
using Ocelot.Library.Configuration.Repository;
|
||||||
using Ocelot.Library.Responses;
|
using Ocelot.Library.Responses;
|
||||||
|
|
||||||
namespace Ocelot.Library.Configuration.Yaml
|
namespace Ocelot.Library.Configuration.Provider
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Register as singleton
|
/// Register as singleton
|
@ -1,8 +1,8 @@
|
|||||||
namespace Ocelot.Library.Configuration.Yaml
|
using System.Collections.Generic;
|
||||||
{
|
using Ocelot.Library.Errors;
|
||||||
using System.Collections.Generic;
|
|
||||||
using Errors;
|
|
||||||
|
|
||||||
|
namespace Ocelot.Library.Configuration.Validator
|
||||||
|
{
|
||||||
public class ConfigurationValidationResult
|
public class ConfigurationValidationResult
|
||||||
{
|
{
|
||||||
public ConfigurationValidationResult(bool isError)
|
public ConfigurationValidationResult(bool isError)
|
@ -1,12 +1,14 @@
|
|||||||
namespace Ocelot.Library.Configuration.Yaml
|
using System;
|
||||||
{
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Authentication;
|
using Ocelot.Library.Authentication;
|
||||||
using Errors;
|
using Ocelot.Library.Authentication.Handler;
|
||||||
using Responses;
|
using Ocelot.Library.Configuration.Yaml;
|
||||||
|
using Ocelot.Library.Errors;
|
||||||
|
using Ocelot.Library.Responses;
|
||||||
|
|
||||||
|
namespace Ocelot.Library.Configuration.Validator
|
||||||
|
{
|
||||||
public class ConfigurationValidator : IConfigurationValidator
|
public class ConfigurationValidator : IConfigurationValidator
|
||||||
{
|
{
|
||||||
public Response<ConfigurationValidationResult> IsValid(YamlConfiguration configuration)
|
public Response<ConfigurationValidationResult> IsValid(YamlConfiguration configuration)
|
||||||
@ -57,7 +59,7 @@
|
|||||||
|
|
||||||
private bool IsSupportedAuthenticationProvider(string provider)
|
private bool IsSupportedAuthenticationProvider(string provider)
|
||||||
{
|
{
|
||||||
SupportAuthenticationProviders supportedProvider;
|
SupportedAuthenticationProviders supportedProvider;
|
||||||
|
|
||||||
return Enum.TryParse(provider, true, out supportedProvider);
|
return Enum.TryParse(provider, true, out supportedProvider);
|
||||||
}
|
}
|
@ -1,7 +1,7 @@
|
|||||||
namespace Ocelot.Library.Configuration.Yaml
|
using Ocelot.Library.Errors;
|
||||||
{
|
|
||||||
using Errors;
|
|
||||||
|
|
||||||
|
namespace Ocelot.Library.Configuration.Validator
|
||||||
|
{
|
||||||
public class DownstreamTemplateAlreadyUsedError : Error
|
public class DownstreamTemplateAlreadyUsedError : Error
|
||||||
{
|
{
|
||||||
public DownstreamTemplateAlreadyUsedError(string message) : base(message, OcelotErrorCode.DownstreamTemplateAlreadyUsedError)
|
public DownstreamTemplateAlreadyUsedError(string message) : base(message, OcelotErrorCode.DownstreamTemplateAlreadyUsedError)
|
@ -1,7 +1,8 @@
|
|||||||
namespace Ocelot.Library.Configuration.Yaml
|
using Ocelot.Library.Configuration.Yaml;
|
||||||
{
|
using Ocelot.Library.Responses;
|
||||||
using Responses;
|
|
||||||
|
|
||||||
|
namespace Ocelot.Library.Configuration.Validator
|
||||||
|
{
|
||||||
public interface IConfigurationValidator
|
public interface IConfigurationValidator
|
||||||
{
|
{
|
||||||
Response<ConfigurationValidationResult> IsValid(YamlConfiguration configuration);
|
Response<ConfigurationValidationResult> IsValid(YamlConfiguration configuration);
|
@ -1,7 +1,7 @@
|
|||||||
namespace Ocelot.Library.Configuration.Yaml
|
using Ocelot.Library.Errors;
|
||||||
{
|
|
||||||
using Errors;
|
|
||||||
|
|
||||||
|
namespace Ocelot.Library.Configuration.Validator
|
||||||
|
{
|
||||||
public class UnsupportedAuthenticationProviderError : Error
|
public class UnsupportedAuthenticationProviderError : Error
|
||||||
{
|
{
|
||||||
public UnsupportedAuthenticationProviderError(string message)
|
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.Parser;
|
||||||
using Ocelot.Library.Configuration.Provider;
|
using Ocelot.Library.Configuration.Provider;
|
||||||
using Ocelot.Library.Configuration.Repository;
|
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
|
namespace Ocelot.Library.DependencyInjection
|
||||||
{
|
{
|
||||||
@ -12,12 +22,9 @@ namespace Ocelot.Library.DependencyInjection
|
|||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using Repository;
|
|
||||||
using RequestBuilder;
|
using RequestBuilder;
|
||||||
using Requester;
|
using Requester;
|
||||||
using Responder;
|
using Responder;
|
||||||
using UrlMatcher;
|
|
||||||
using UrlTemplateReplacer;
|
|
||||||
|
|
||||||
public static class ServiceCollectionExtensions
|
public static class ServiceCollectionExtensions
|
||||||
{
|
{
|
||||||
@ -48,7 +55,7 @@ namespace Ocelot.Library.DependencyInjection
|
|||||||
services.AddSingleton<IUrlPathToUrlTemplateMatcher, RegExUrlMatcher>();
|
services.AddSingleton<IUrlPathToUrlTemplateMatcher, RegExUrlMatcher>();
|
||||||
services.AddSingleton<ITemplateVariableNameAndValueFinder, TemplateVariableNameAndValueFinder>();
|
services.AddSingleton<ITemplateVariableNameAndValueFinder, TemplateVariableNameAndValueFinder>();
|
||||||
services.AddSingleton<IDownstreamUrlTemplateVariableReplacer, DownstreamUrlTemplateVariableReplacer>();
|
services.AddSingleton<IDownstreamUrlTemplateVariableReplacer, DownstreamUrlTemplateVariableReplacer>();
|
||||||
services.AddSingleton<IDownstreamRouteFinder, DownstreamRouteFinder>();
|
services.AddSingleton<IDownstreamRouteFinder, DownstreamRouteFinder.Finder.DownstreamRouteFinder>();
|
||||||
services.AddSingleton<IHttpRequester, HttpClientHttpRequester>();
|
services.AddSingleton<IHttpRequester, HttpClientHttpRequester>();
|
||||||
services.AddSingleton<IHttpResponder, HttpContextResponder>();
|
services.AddSingleton<IHttpResponder, HttpContextResponder>();
|
||||||
services.AddSingleton<IRequestBuilder, HttpRequestBuilder>();
|
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 System.Collections.Generic;
|
||||||
using Configuration;
|
using Configuration;
|
||||||
using UrlMatcher;
|
|
||||||
|
|
||||||
public class DownstreamRoute
|
public class DownstreamRoute
|
||||||
{
|
{
|
||||||
|
@ -2,11 +2,11 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Ocelot.Library.Configuration.Provider;
|
using Ocelot.Library.Configuration.Provider;
|
||||||
|
using Ocelot.Library.DownstreamRouteFinder.UrlMatcher;
|
||||||
using Ocelot.Library.Errors;
|
using Ocelot.Library.Errors;
|
||||||
using Ocelot.Library.Responses;
|
using Ocelot.Library.Responses;
|
||||||
using Ocelot.Library.UrlMatcher;
|
|
||||||
|
|
||||||
namespace Ocelot.Library.DownstreamRouteFinder
|
namespace Ocelot.Library.DownstreamRouteFinder.Finder
|
||||||
{
|
{
|
||||||
public class DownstreamRouteFinder : IDownstreamRouteFinder
|
public class DownstreamRouteFinder : IDownstreamRouteFinder
|
||||||
{
|
{
|
@ -1,7 +1,7 @@
|
|||||||
namespace Ocelot.Library.DownstreamRouteFinder
|
using Ocelot.Library.Responses;
|
||||||
{
|
|
||||||
using Responses;
|
|
||||||
|
|
||||||
|
namespace Ocelot.Library.DownstreamRouteFinder.Finder
|
||||||
|
{
|
||||||
public interface IDownstreamRouteFinder
|
public interface IDownstreamRouteFinder
|
||||||
{
|
{
|
||||||
Response<DownstreamRoute> FindDownstreamRoute(string upstreamUrlPath, string upstreamHttpMethod);
|
Response<DownstreamRoute> FindDownstreamRoute(string upstreamUrlPath, string upstreamHttpMethod);
|
@ -1,7 +1,7 @@
|
|||||||
namespace Ocelot.Library.DownstreamRouteFinder
|
using Ocelot.Library.Errors;
|
||||||
{
|
|
||||||
using Errors;
|
|
||||||
|
|
||||||
|
namespace Ocelot.Library.DownstreamRouteFinder.Finder
|
||||||
|
{
|
||||||
public class UnableToFindDownstreamRouteError : Error
|
public class UnableToFindDownstreamRouteError : Error
|
||||||
{
|
{
|
||||||
public UnableToFindDownstreamRouteError() : base("UnableToFindDownstreamRouteError", OcelotErrorCode.UnableToFindDownstreamRouteError)
|
public UnableToFindDownstreamRouteError() : base("UnableToFindDownstreamRouteError", OcelotErrorCode.UnableToFindDownstreamRouteError)
|
@ -1,10 +1,11 @@
|
|||||||
namespace Ocelot.Library.Middleware
|
|
||||||
{
|
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using DownstreamRouteFinder;
|
|
||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
using Repository;
|
using Ocelot.Library.DownstreamRouteFinder.Finder;
|
||||||
|
using Ocelot.Library.Middleware;
|
||||||
|
using Ocelot.Library.ScopedData;
|
||||||
|
|
||||||
|
namespace Ocelot.Library.DownstreamRouteFinder.Middleware
|
||||||
|
{
|
||||||
public class DownstreamRouteFinderMiddleware : OcelotMiddleware
|
public class DownstreamRouteFinderMiddleware : OcelotMiddleware
|
||||||
{
|
{
|
||||||
private readonly RequestDelegate _next;
|
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 class DownstreamRouteFinderMiddlewareExtensions
|
||||||
{
|
{
|
||||||
public static IApplicationBuilder UseDownstreamRouteFinderMiddleware(this IApplicationBuilder builder)
|
public static IApplicationBuilder UseDownstreamRouteFinderMiddleware(this IApplicationBuilder builder)
|
@ -1,8 +1,8 @@
|
|||||||
namespace Ocelot.Library.UrlMatcher
|
using System.Collections.Generic;
|
||||||
{
|
using Ocelot.Library.Responses;
|
||||||
using System.Collections.Generic;
|
|
||||||
using Responses;
|
|
||||||
|
|
||||||
|
namespace Ocelot.Library.DownstreamRouteFinder.UrlMatcher
|
||||||
|
{
|
||||||
public interface ITemplateVariableNameAndValueFinder
|
public interface ITemplateVariableNameAndValueFinder
|
||||||
{
|
{
|
||||||
Response<List<TemplateVariableNameAndValue>> Find(string upstreamUrlPath, string upstreamUrlPathTemplate);
|
Response<List<TemplateVariableNameAndValue>> Find(string upstreamUrlPath, string upstreamUrlPathTemplate);
|
@ -1,7 +1,7 @@
|
|||||||
namespace Ocelot.Library.UrlMatcher
|
using Ocelot.Library.Responses;
|
||||||
{
|
|
||||||
using Responses;
|
|
||||||
|
|
||||||
|
namespace Ocelot.Library.DownstreamRouteFinder.UrlMatcher
|
||||||
|
{
|
||||||
public interface IUrlPathToUrlTemplateMatcher
|
public interface IUrlPathToUrlTemplateMatcher
|
||||||
{
|
{
|
||||||
Response<UrlMatch> Match(string upstreamUrlPath, string upstreamUrlPathTemplate);
|
Response<UrlMatch> Match(string upstreamUrlPath, string upstreamUrlPathTemplate);
|
@ -1,8 +1,8 @@
|
|||||||
namespace Ocelot.Library.UrlMatcher
|
using System.Text.RegularExpressions;
|
||||||
{
|
using Ocelot.Library.Responses;
|
||||||
using System.Text.RegularExpressions;
|
|
||||||
using Responses;
|
|
||||||
|
|
||||||
|
namespace Ocelot.Library.DownstreamRouteFinder.UrlMatcher
|
||||||
|
{
|
||||||
public class RegExUrlMatcher : IUrlPathToUrlTemplateMatcher
|
public class RegExUrlMatcher : IUrlPathToUrlTemplateMatcher
|
||||||
{
|
{
|
||||||
public Response<UrlMatch> Match(string upstreamUrlPath, string upstreamUrlPathTemplate)
|
public Response<UrlMatch> Match(string upstreamUrlPath, string upstreamUrlPathTemplate)
|
@ -1,4 +1,4 @@
|
|||||||
namespace Ocelot.Library.UrlMatcher
|
namespace Ocelot.Library.DownstreamRouteFinder.UrlMatcher
|
||||||
{
|
{
|
||||||
public class TemplateVariableNameAndValue
|
public class TemplateVariableNameAndValue
|
||||||
{
|
{
|
@ -1,8 +1,8 @@
|
|||||||
namespace Ocelot.Library.UrlMatcher
|
|
||||||
{
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Responses;
|
using Ocelot.Library.Responses;
|
||||||
|
|
||||||
|
namespace Ocelot.Library.DownstreamRouteFinder.UrlMatcher
|
||||||
|
{
|
||||||
public class TemplateVariableNameAndValueFinder : ITemplateVariableNameAndValueFinder
|
public class TemplateVariableNameAndValueFinder : ITemplateVariableNameAndValueFinder
|
||||||
{
|
{
|
||||||
public Response<List<TemplateVariableNameAndValue>> Find(string upstreamUrlPath, string upstreamUrlPathTemplate)
|
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
|
public class UrlMatch
|
||||||
{
|
{
|
@ -1,11 +1,12 @@
|
|||||||
namespace Ocelot.Library.Middleware
|
|
||||||
{
|
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using DownstreamRouteFinder;
|
|
||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
using Repository;
|
using Ocelot.Library.DownstreamRouteFinder;
|
||||||
using UrlTemplateReplacer;
|
using Ocelot.Library.DownstreamUrlCreator.UrlTemplateReplacer;
|
||||||
|
using Ocelot.Library.Middleware;
|
||||||
|
using Ocelot.Library.ScopedData;
|
||||||
|
|
||||||
|
namespace Ocelot.Library.DownstreamUrlCreator.Middleware
|
||||||
|
{
|
||||||
public class DownstreamUrlCreatorMiddleware : OcelotMiddleware
|
public class DownstreamUrlCreatorMiddleware : OcelotMiddleware
|
||||||
{
|
{
|
||||||
private readonly RequestDelegate _next;
|
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 class DownstreamUrlCreatorMiddlewareExtensions
|
||||||
{
|
{
|
||||||
public static IApplicationBuilder UseDownstreamUrlCreatorMiddleware(this IApplicationBuilder builder)
|
public static IApplicationBuilder UseDownstreamUrlCreatorMiddleware(this IApplicationBuilder builder)
|
@ -1,9 +1,9 @@
|
|||||||
namespace Ocelot.Library.UrlTemplateReplacer
|
|
||||||
{
|
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using DownstreamRouteFinder;
|
using Ocelot.Library.DownstreamRouteFinder;
|
||||||
using Responses;
|
using Ocelot.Library.Responses;
|
||||||
|
|
||||||
|
namespace Ocelot.Library.DownstreamUrlCreator.UrlTemplateReplacer
|
||||||
|
{
|
||||||
public class DownstreamUrlTemplateVariableReplacer : IDownstreamUrlTemplateVariableReplacer
|
public class DownstreamUrlTemplateVariableReplacer : IDownstreamUrlTemplateVariableReplacer
|
||||||
{
|
{
|
||||||
public Response<string> ReplaceTemplateVariables(DownstreamRoute downstreamRoute)
|
public Response<string> ReplaceTemplateVariables(DownstreamRoute downstreamRoute)
|
@ -1,8 +1,8 @@
|
|||||||
namespace Ocelot.Library.UrlTemplateReplacer
|
using Ocelot.Library.DownstreamRouteFinder;
|
||||||
{
|
using Ocelot.Library.Responses;
|
||||||
using DownstreamRouteFinder;
|
|
||||||
using Responses;
|
|
||||||
|
|
||||||
|
namespace Ocelot.Library.DownstreamUrlCreator.UrlTemplateReplacer
|
||||||
|
{
|
||||||
public interface IDownstreamUrlTemplateVariableReplacer
|
public interface IDownstreamUrlTemplateVariableReplacer
|
||||||
{
|
{
|
||||||
Response<string> ReplaceTemplateVariables(DownstreamRoute downstreamRoute);
|
Response<string> ReplaceTemplateVariables(DownstreamRoute downstreamRoute);
|
@ -3,9 +3,10 @@ using System.Linq;
|
|||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
using Microsoft.Extensions.Primitives;
|
using Microsoft.Extensions.Primitives;
|
||||||
using Ocelot.Library.Configuration;
|
using Ocelot.Library.Configuration;
|
||||||
|
using Ocelot.Library.HeaderBuilder.Parser;
|
||||||
using Ocelot.Library.Responses;
|
using Ocelot.Library.Responses;
|
||||||
|
|
||||||
namespace Ocelot.Library.RequestBuilder
|
namespace Ocelot.Library.HeaderBuilder
|
||||||
{
|
{
|
||||||
public class AddHeadersToRequest : IAddHeadersToRequest
|
public class AddHeadersToRequest : IAddHeadersToRequest
|
||||||
{
|
{
|
@ -3,7 +3,7 @@ using Microsoft.AspNetCore.Http;
|
|||||||
using Ocelot.Library.Configuration;
|
using Ocelot.Library.Configuration;
|
||||||
using Ocelot.Library.Responses;
|
using Ocelot.Library.Responses;
|
||||||
|
|
||||||
namespace Ocelot.Library.RequestBuilder
|
namespace Ocelot.Library.HeaderBuilder
|
||||||
{
|
{
|
||||||
public interface IAddHeadersToRequest
|
public interface IAddHeadersToRequest
|
||||||
{
|
{
|
@ -1,15 +1,12 @@
|
|||||||
using System.Collections.Generic;
|
using System.Linq;
|
||||||
using System.Linq;
|
|
||||||
using Microsoft.Extensions.Primitives;
|
|
||||||
using Ocelot.Library.DownstreamRouteFinder;
|
|
||||||
using Ocelot.Library.RequestBuilder;
|
|
||||||
|
|
||||||
namespace Ocelot.Library.Middleware
|
|
||||||
{
|
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
using Repository;
|
using Ocelot.Library.DownstreamRouteFinder;
|
||||||
|
using Ocelot.Library.Middleware;
|
||||||
|
using Ocelot.Library.ScopedData;
|
||||||
|
|
||||||
|
namespace Ocelot.Library.HeaderBuilder.Middleware
|
||||||
|
{
|
||||||
public class HttpRequestHeadersBuilderMiddleware : OcelotMiddleware
|
public class HttpRequestHeadersBuilderMiddleware : OcelotMiddleware
|
||||||
{
|
{
|
||||||
private readonly RequestDelegate _next;
|
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 class HttpRequestHeadersBuilderMiddlewareExtensions
|
||||||
{
|
{
|
||||||
public static IApplicationBuilder UseHttpRequestHeadersBuilderMiddleware(this IApplicationBuilder builder)
|
public static IApplicationBuilder UseHttpRequestHeadersBuilderMiddleware(this IApplicationBuilder builder)
|
@ -1,6 +1,6 @@
|
|||||||
using Ocelot.Library.Errors;
|
using Ocelot.Library.Errors;
|
||||||
|
|
||||||
namespace Ocelot.Library.RequestBuilder
|
namespace Ocelot.Library.HeaderBuilder.Parser
|
||||||
{
|
{
|
||||||
public class CannotFindClaimError : Error
|
public class CannotFindClaimError : Error
|
||||||
{
|
{
|
@ -4,7 +4,7 @@ using System.Security.Claims;
|
|||||||
using Ocelot.Library.Errors;
|
using Ocelot.Library.Errors;
|
||||||
using Ocelot.Library.Responses;
|
using Ocelot.Library.Responses;
|
||||||
|
|
||||||
namespace Ocelot.Library.RequestBuilder
|
namespace Ocelot.Library.HeaderBuilder.Parser
|
||||||
{
|
{
|
||||||
public class ClaimsParser : IClaimsParser
|
public class ClaimsParser : IClaimsParser
|
||||||
{
|
{
|
@ -2,7 +2,7 @@
|
|||||||
using System.Security.Claims;
|
using System.Security.Claims;
|
||||||
using Ocelot.Library.Responses;
|
using Ocelot.Library.Responses;
|
||||||
|
|
||||||
namespace Ocelot.Library.RequestBuilder
|
namespace Ocelot.Library.HeaderBuilder.Parser
|
||||||
{
|
{
|
||||||
public interface IClaimsParser
|
public interface IClaimsParser
|
||||||
{
|
{
|
@ -1,8 +1,9 @@
|
|||||||
namespace Ocelot.Library.Middleware
|
using Ocelot.Library.ScopedData;
|
||||||
|
|
||||||
|
namespace Ocelot.Library.Middleware
|
||||||
{
|
{
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Errors;
|
using Errors;
|
||||||
using Repository;
|
|
||||||
|
|
||||||
public abstract class OcelotMiddleware
|
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;
|
using Microsoft.AspNetCore.Builder;
|
||||||
|
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
namespace Ocelot.Library.RequestBuilder
|
using System;
|
||||||
{
|
|
||||||
using System;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
using System.Net.Http.Headers;
|
using System.Net.Http.Headers;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
using Responses;
|
using Ocelot.Library.Responses;
|
||||||
|
|
||||||
|
namespace Ocelot.Library.RequestBuilder.Builder
|
||||||
|
{
|
||||||
public class HttpRequestBuilder : IRequestBuilder
|
public class HttpRequestBuilder : IRequestBuilder
|
||||||
{
|
{
|
||||||
public async Task<Response<Request>> Build(string httpMethod, string downstreamUrl, Stream content, IHeaderDictionary headers,
|
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.IO;
|
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
using Responses;
|
using Ocelot.Library.Responses;
|
||||||
|
|
||||||
|
namespace Ocelot.Library.RequestBuilder.Builder
|
||||||
|
{
|
||||||
public interface IRequestBuilder
|
public interface IRequestBuilder
|
||||||
{
|
{
|
||||||
Task<Response<Request>> Build(string httpMethod,
|
Task<Response<Request>> Build(string httpMethod,
|
@ -1,10 +1,11 @@
|
|||||||
namespace Ocelot.Library.Middleware
|
|
||||||
{
|
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
using Repository;
|
using Ocelot.Library.Middleware;
|
||||||
using RequestBuilder;
|
using Ocelot.Library.RequestBuilder.Builder;
|
||||||
|
using Ocelot.Library.ScopedData;
|
||||||
|
|
||||||
|
namespace Ocelot.Library.RequestBuilder.Middleware
|
||||||
|
{
|
||||||
public class HttpRequestBuilderMiddleware : OcelotMiddleware
|
public class HttpRequestBuilderMiddleware : OcelotMiddleware
|
||||||
{
|
{
|
||||||
private readonly RequestDelegate _next;
|
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 class HttpRequestBuilderMiddlewareExtensions
|
||||||
{
|
{
|
||||||
public static IApplicationBuilder UseHttpRequestBuilderMiddleware(this IApplicationBuilder builder)
|
public static IApplicationBuilder UseHttpRequestBuilderMiddleware(this IApplicationBuilder builder)
|
@ -1,11 +1,11 @@
|
|||||||
namespace Ocelot.Library.Middleware
|
|
||||||
{
|
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
using Repository;
|
using Ocelot.Library.Middleware;
|
||||||
using RequestBuilder;
|
using Ocelot.Library.RequestBuilder;
|
||||||
using Requester;
|
using Ocelot.Library.ScopedData;
|
||||||
|
|
||||||
|
namespace Ocelot.Library.Requester.Middleware
|
||||||
|
{
|
||||||
public class HttpRequesterMiddleware : OcelotMiddleware
|
public class HttpRequesterMiddleware : OcelotMiddleware
|
||||||
{
|
{
|
||||||
private readonly RequestDelegate _next;
|
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 class HttpRequesterMiddlewareExtensions
|
||||||
{
|
{
|
||||||
public static IApplicationBuilder UseHttpRequesterMiddleware(this IApplicationBuilder builder)
|
public static IApplicationBuilder UseHttpRequesterMiddleware(this IApplicationBuilder builder)
|
@ -1,11 +1,11 @@
|
|||||||
namespace Ocelot.Library.Middleware
|
|
||||||
{
|
|
||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
using Repository;
|
using Ocelot.Library.Middleware;
|
||||||
using Responder;
|
using Ocelot.Library.ScopedData;
|
||||||
|
|
||||||
|
namespace Ocelot.Library.Responder.Middleware
|
||||||
|
{
|
||||||
public class HttpResponderMiddleware : OcelotMiddleware
|
public class HttpResponderMiddleware : OcelotMiddleware
|
||||||
{
|
{
|
||||||
private readonly RequestDelegate _next;
|
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 class HttpResponderMiddlewareExtensions
|
||||||
{
|
{
|
||||||
public static IApplicationBuilder UseHttpResponderMiddleware(this IApplicationBuilder builder)
|
public static IApplicationBuilder UseHttpResponderMiddleware(this IApplicationBuilder builder)
|
@ -1,7 +1,7 @@
|
|||||||
namespace Ocelot.Library.Repository
|
using Ocelot.Library.Errors;
|
||||||
{
|
|
||||||
using Errors;
|
|
||||||
|
|
||||||
|
namespace Ocelot.Library.ScopedData
|
||||||
|
{
|
||||||
public class CannotAddDataError : Error
|
public class CannotAddDataError : Error
|
||||||
{
|
{
|
||||||
public CannotAddDataError(string message) : base(message, OcelotErrorCode.CannotAddDataError)
|
public CannotAddDataError(string message) : base(message, OcelotErrorCode.CannotAddDataError)
|
@ -1,7 +1,7 @@
|
|||||||
namespace Ocelot.Library.Repository
|
using Ocelot.Library.Errors;
|
||||||
{
|
|
||||||
using Errors;
|
|
||||||
|
|
||||||
|
namespace Ocelot.Library.ScopedData
|
||||||
|
{
|
||||||
public class CannotFindDataError : Error
|
public class CannotFindDataError : Error
|
||||||
{
|
{
|
||||||
public CannotFindDataError(string message) : base(message, OcelotErrorCode.CannotFindDataError)
|
public CannotFindDataError(string message) : base(message, OcelotErrorCode.CannotFindDataError)
|
@ -1,7 +1,7 @@
|
|||||||
namespace Ocelot.Library.Repository
|
using Ocelot.Library.Responses;
|
||||||
{
|
|
||||||
using Responses;
|
|
||||||
|
|
||||||
|
namespace Ocelot.Library.ScopedData
|
||||||
|
{
|
||||||
public interface IScopedRequestDataRepository
|
public interface IScopedRequestDataRepository
|
||||||
{
|
{
|
||||||
Response Add<T>(string key, T value);
|
Response Add<T>(string key, T value);
|
@ -1,11 +1,11 @@
|
|||||||
namespace Ocelot.Library.Repository
|
using System;
|
||||||
{
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Errors;
|
|
||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
using Responses;
|
using Ocelot.Library.Errors;
|
||||||
|
using Ocelot.Library.Responses;
|
||||||
|
|
||||||
|
namespace Ocelot.Library.ScopedData
|
||||||
|
{
|
||||||
public class ScopedRequestDataRepository : IScopedRequestDataRepository
|
public class ScopedRequestDataRepository : IScopedRequestDataRepository
|
||||||
{
|
{
|
||||||
private readonly IHttpContextAccessor _httpContextAccessor;
|
private readonly IHttpContextAccessor _httpContextAccessor;
|
@ -3,6 +3,9 @@ using System.Threading.Tasks;
|
|||||||
using Microsoft.AspNetCore.Builder;
|
using Microsoft.AspNetCore.Builder;
|
||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
using Moq;
|
using Moq;
|
||||||
|
using Ocelot.Library.Authentication.Handler;
|
||||||
|
using Ocelot.Library.Authentication.Handler.Creator;
|
||||||
|
using Ocelot.Library.Authentication.Handler.Factory;
|
||||||
using Shouldly;
|
using Shouldly;
|
||||||
using TestStack.BDDfy;
|
using TestStack.BDDfy;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
@ -6,19 +6,18 @@ using Microsoft.AspNetCore.Hosting;
|
|||||||
using Microsoft.AspNetCore.TestHost;
|
using Microsoft.AspNetCore.TestHost;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using Moq;
|
using Moq;
|
||||||
|
using Ocelot.Library.Authentication.Handler.Factory;
|
||||||
|
using Ocelot.Library.Authentication.Middleware;
|
||||||
using Ocelot.Library.Configuration.Builder;
|
using Ocelot.Library.Configuration.Builder;
|
||||||
|
using Ocelot.Library.DownstreamRouteFinder;
|
||||||
|
using Ocelot.Library.DownstreamRouteFinder.UrlMatcher;
|
||||||
|
using Ocelot.Library.Responses;
|
||||||
|
using Ocelot.Library.ScopedData;
|
||||||
using TestStack.BDDfy;
|
using TestStack.BDDfy;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace Ocelot.UnitTests.Middleware
|
namespace Ocelot.UnitTests.Authentication
|
||||||
{
|
{
|
||||||
using Library.Authentication;
|
|
||||||
using Library.DownstreamRouteFinder;
|
|
||||||
using Library.Middleware;
|
|
||||||
using Library.Repository;
|
|
||||||
using Library.Responses;
|
|
||||||
using Library.UrlMatcher;
|
|
||||||
|
|
||||||
public class AuthenticationMiddlewareTests : IDisposable
|
public class AuthenticationMiddlewareTests : IDisposable
|
||||||
{
|
{
|
||||||
private readonly Mock<IScopedRequestDataRepository> _scopedRepository;
|
private readonly Mock<IScopedRequestDataRepository> _scopedRepository;
|
@ -3,13 +3,12 @@ using System.Linq;
|
|||||||
using Ocelot.Library.Configuration;
|
using Ocelot.Library.Configuration;
|
||||||
using Ocelot.Library.Configuration.Parser;
|
using Ocelot.Library.Configuration.Parser;
|
||||||
using Ocelot.Library.Errors;
|
using Ocelot.Library.Errors;
|
||||||
using Ocelot.Library.RequestBuilder;
|
|
||||||
using Ocelot.Library.Responses;
|
using Ocelot.Library.Responses;
|
||||||
using Shouldly;
|
using Shouldly;
|
||||||
using TestStack.BDDfy;
|
using TestStack.BDDfy;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace Ocelot.UnitTests.RequestBuilder
|
namespace Ocelot.UnitTests.Configuration
|
||||||
{
|
{
|
||||||
public class ConfigurationHeadersExtractorTests
|
public class ConfigurationHeadersExtractorTests
|
||||||
{
|
{
|
@ -1,4 +1,5 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using Ocelot.Library.Configuration.Validator;
|
||||||
using Shouldly;
|
using Shouldly;
|
||||||
using TestStack.BDDfy;
|
using TestStack.BDDfy;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
@ -3,8 +3,10 @@ using Microsoft.Extensions.Logging;
|
|||||||
using Microsoft.Extensions.Options;
|
using Microsoft.Extensions.Options;
|
||||||
using Moq;
|
using Moq;
|
||||||
using Ocelot.Library.Configuration.Builder;
|
using Ocelot.Library.Configuration.Builder;
|
||||||
|
using Ocelot.Library.Configuration.Creator;
|
||||||
using Ocelot.Library.Configuration.Parser;
|
using Ocelot.Library.Configuration.Parser;
|
||||||
using Ocelot.Library.Configuration.Repository;
|
using Ocelot.Library.Configuration.Repository;
|
||||||
|
using Ocelot.Library.Configuration.Validator;
|
||||||
using Ocelot.Library.RequestBuilder;
|
using Ocelot.Library.RequestBuilder;
|
||||||
using Shouldly;
|
using Shouldly;
|
||||||
using TestStack.BDDfy;
|
using TestStack.BDDfy;
|
||||||
|
@ -7,17 +7,17 @@ using Microsoft.AspNetCore.TestHost;
|
|||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using Moq;
|
using Moq;
|
||||||
using Ocelot.Library.Configuration.Builder;
|
using Ocelot.Library.Configuration.Builder;
|
||||||
|
using Ocelot.Library.DownstreamRouteFinder;
|
||||||
|
using Ocelot.Library.DownstreamRouteFinder.Finder;
|
||||||
|
using Ocelot.Library.DownstreamRouteFinder.Middleware;
|
||||||
|
using Ocelot.Library.DownstreamRouteFinder.UrlMatcher;
|
||||||
|
using Ocelot.Library.Responses;
|
||||||
|
using Ocelot.Library.ScopedData;
|
||||||
using TestStack.BDDfy;
|
using TestStack.BDDfy;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace Ocelot.UnitTests.Middleware
|
namespace Ocelot.UnitTests.DownstreamRouteFinder
|
||||||
{
|
{
|
||||||
using Library.DownstreamRouteFinder;
|
|
||||||
using Library.Middleware;
|
|
||||||
using Library.Repository;
|
|
||||||
using Library.Responses;
|
|
||||||
using Library.UrlMatcher;
|
|
||||||
|
|
||||||
public class DownstreamRouteFinderMiddlewareTests : IDisposable
|
public class DownstreamRouteFinderMiddlewareTests : IDisposable
|
||||||
{
|
{
|
||||||
private readonly Mock<IDownstreamRouteFinder> _downstreamRouteFinder;
|
private readonly Mock<IDownstreamRouteFinder> _downstreamRouteFinder;
|
@ -2,6 +2,8 @@
|
|||||||
using Moq;
|
using Moq;
|
||||||
using Ocelot.Library.Configuration.Builder;
|
using Ocelot.Library.Configuration.Builder;
|
||||||
using Ocelot.Library.Configuration.Provider;
|
using Ocelot.Library.Configuration.Provider;
|
||||||
|
using Ocelot.Library.DownstreamRouteFinder.Finder;
|
||||||
|
using Ocelot.Library.DownstreamRouteFinder.UrlMatcher;
|
||||||
using Shouldly;
|
using Shouldly;
|
||||||
using TestStack.BDDfy;
|
using TestStack.BDDfy;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
@ -11,7 +13,6 @@ namespace Ocelot.UnitTests.DownstreamRouteFinder
|
|||||||
using Library.Configuration;
|
using Library.Configuration;
|
||||||
using Library.DownstreamRouteFinder;
|
using Library.DownstreamRouteFinder;
|
||||||
using Library.Responses;
|
using Library.Responses;
|
||||||
using Library.UrlMatcher;
|
|
||||||
|
|
||||||
public class DownstreamRouteFinderTests
|
public class DownstreamRouteFinderTests
|
||||||
{
|
{
|
||||||
@ -30,7 +31,7 @@ namespace Ocelot.UnitTests.DownstreamRouteFinder
|
|||||||
_mockConfig = new Mock<IOcelotConfigurationProvider>();
|
_mockConfig = new Mock<IOcelotConfigurationProvider>();
|
||||||
_mockMatcher = new Mock<IUrlPathToUrlTemplateMatcher>();
|
_mockMatcher = new Mock<IUrlPathToUrlTemplateMatcher>();
|
||||||
_finder = new Mock<ITemplateVariableNameAndValueFinder>();
|
_finder = new Mock<ITemplateVariableNameAndValueFinder>();
|
||||||
_downstreamRouteFinder = new DownstreamRouteFinder(_mockConfig.Object, _mockMatcher.Object, _finder.Object);
|
_downstreamRouteFinder = new Library.DownstreamRouteFinder.Finder.DownstreamRouteFinder(_mockConfig.Object, _mockMatcher.Object, _finder.Object);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
|
@ -1,12 +1,11 @@
|
|||||||
|
using Ocelot.Library.DownstreamRouteFinder.UrlMatcher;
|
||||||
|
using Ocelot.Library.Responses;
|
||||||
using Shouldly;
|
using Shouldly;
|
||||||
using TestStack.BDDfy;
|
using TestStack.BDDfy;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace Ocelot.UnitTests.UrlMatcher
|
namespace Ocelot.UnitTests.DownstreamRouteFinder.UrlMatcher
|
||||||
{
|
{
|
||||||
using Library.Responses;
|
|
||||||
using Library.UrlMatcher;
|
|
||||||
|
|
||||||
public class RegExUrlMatcherTests
|
public class RegExUrlMatcherTests
|
||||||
{
|
{
|
||||||
private readonly IUrlPathToUrlTemplateMatcher _urlMatcher;
|
private readonly IUrlPathToUrlTemplateMatcher _urlMatcher;
|
@ -1,14 +1,13 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using Ocelot.Library.DownstreamRouteFinder.UrlMatcher;
|
||||||
|
using Ocelot.Library.Responses;
|
||||||
using Shouldly;
|
using Shouldly;
|
||||||
using TestStack.BDDfy;
|
using TestStack.BDDfy;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace Ocelot.UnitTests.UrlMatcher
|
namespace Ocelot.UnitTests.DownstreamRouteFinder.UrlMatcher
|
||||||
{
|
{
|
||||||
using Library.Responses;
|
|
||||||
using Library.UrlMatcher;
|
|
||||||
|
|
||||||
public class UrlPathToUrlTemplateMatcherTests
|
public class UrlPathToUrlTemplateMatcherTests
|
||||||
{
|
{
|
||||||
private readonly ITemplateVariableNameAndValueFinder _finder;
|
private readonly ITemplateVariableNameAndValueFinder _finder;
|
@ -1,24 +1,23 @@
|
|||||||
using Ocelot.Library.Configuration.Builder;
|
using System;
|
||||||
|
|
||||||
namespace Ocelot.UnitTests.Middleware
|
|
||||||
{
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
using Library.DownstreamRouteFinder;
|
|
||||||
using Library.Middleware;
|
|
||||||
using Library.Repository;
|
|
||||||
using Library.Responses;
|
|
||||||
using Library.UrlMatcher;
|
|
||||||
using Library.UrlTemplateReplacer;
|
|
||||||
using Microsoft.AspNetCore.Hosting;
|
using Microsoft.AspNetCore.Hosting;
|
||||||
using Microsoft.AspNetCore.TestHost;
|
using Microsoft.AspNetCore.TestHost;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using Moq;
|
using Moq;
|
||||||
|
using Ocelot.Library.Configuration.Builder;
|
||||||
|
using Ocelot.Library.DownstreamRouteFinder;
|
||||||
|
using Ocelot.Library.DownstreamRouteFinder.UrlMatcher;
|
||||||
|
using Ocelot.Library.DownstreamUrlCreator.Middleware;
|
||||||
|
using Ocelot.Library.DownstreamUrlCreator.UrlTemplateReplacer;
|
||||||
|
using Ocelot.Library.Responses;
|
||||||
|
using Ocelot.Library.ScopedData;
|
||||||
using TestStack.BDDfy;
|
using TestStack.BDDfy;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
|
namespace Ocelot.UnitTests.DownstreamUrlCreator
|
||||||
|
{
|
||||||
public class DownstreamUrlCreatorMiddlewareTests : IDisposable
|
public class DownstreamUrlCreatorMiddlewareTests : IDisposable
|
||||||
{
|
{
|
||||||
private readonly Mock<IDownstreamUrlTemplateVariableReplacer> _downstreamUrlTemplateVariableReplacer;
|
private readonly Mock<IDownstreamUrlTemplateVariableReplacer> _downstreamUrlTemplateVariableReplacer;
|
@ -1,16 +1,15 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Ocelot.Library.Configuration.Builder;
|
using Ocelot.Library.Configuration.Builder;
|
||||||
|
using Ocelot.Library.DownstreamRouteFinder;
|
||||||
|
using Ocelot.Library.DownstreamRouteFinder.UrlMatcher;
|
||||||
|
using Ocelot.Library.DownstreamUrlCreator.UrlTemplateReplacer;
|
||||||
|
using Ocelot.Library.Responses;
|
||||||
using Shouldly;
|
using Shouldly;
|
||||||
using TestStack.BDDfy;
|
using TestStack.BDDfy;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace Ocelot.UnitTests.UrlTemplateReplacer
|
namespace Ocelot.UnitTests.DownstreamUrlCreator.UrlTemplateReplacer
|
||||||
{
|
{
|
||||||
using Library.DownstreamRouteFinder;
|
|
||||||
using Library.Responses;
|
|
||||||
using Library.UrlMatcher;
|
|
||||||
using Library.UrlTemplateReplacer;
|
|
||||||
|
|
||||||
public class UpstreamUrlPathTemplateVariableReplacerTests
|
public class UpstreamUrlPathTemplateVariableReplacerTests
|
||||||
{
|
{
|
||||||
private DownstreamRoute _downstreamRoute;
|
private DownstreamRoute _downstreamRoute;
|
@ -6,13 +6,14 @@ using Microsoft.Extensions.Primitives;
|
|||||||
using Moq;
|
using Moq;
|
||||||
using Ocelot.Library.Configuration;
|
using Ocelot.Library.Configuration;
|
||||||
using Ocelot.Library.Errors;
|
using Ocelot.Library.Errors;
|
||||||
using Ocelot.Library.RequestBuilder;
|
using Ocelot.Library.HeaderBuilder;
|
||||||
|
using Ocelot.Library.HeaderBuilder.Parser;
|
||||||
using Ocelot.Library.Responses;
|
using Ocelot.Library.Responses;
|
||||||
using Shouldly;
|
using Shouldly;
|
||||||
using TestStack.BDDfy;
|
using TestStack.BDDfy;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace Ocelot.UnitTests.RequestBuilder
|
namespace Ocelot.UnitTests.HeaderBuilder
|
||||||
{
|
{
|
||||||
public class AddHeadersToRequestTests
|
public class AddHeadersToRequestTests
|
||||||
{
|
{
|
@ -1,13 +1,13 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Security.Claims;
|
using System.Security.Claims;
|
||||||
using Ocelot.Library.Errors;
|
using Ocelot.Library.Errors;
|
||||||
using Ocelot.Library.RequestBuilder;
|
using Ocelot.Library.HeaderBuilder.Parser;
|
||||||
using Ocelot.Library.Responses;
|
using Ocelot.Library.Responses;
|
||||||
using Shouldly;
|
using Shouldly;
|
||||||
using TestStack.BDDfy;
|
using TestStack.BDDfy;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace Ocelot.UnitTests.RequestBuilder
|
namespace Ocelot.UnitTests.HeaderBuilder
|
||||||
{
|
{
|
||||||
public class ClaimParserTests
|
public class ClaimParserTests
|
||||||
{
|
{
|
||||||
@ -21,7 +21,7 @@ namespace Ocelot.UnitTests.RequestBuilder
|
|||||||
public ClaimParserTests()
|
public ClaimParserTests()
|
||||||
{
|
{
|
||||||
_claims = new List<Claim>();
|
_claims = new List<Claim>();
|
||||||
_claimsParser = new Library.RequestBuilder.ClaimsParser();
|
_claimsParser = new ClaimsParser();
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
@ -10,15 +10,15 @@ using Moq;
|
|||||||
using Ocelot.Library.Configuration;
|
using Ocelot.Library.Configuration;
|
||||||
using Ocelot.Library.Configuration.Builder;
|
using Ocelot.Library.Configuration.Builder;
|
||||||
using Ocelot.Library.DownstreamRouteFinder;
|
using Ocelot.Library.DownstreamRouteFinder;
|
||||||
using Ocelot.Library.Middleware;
|
using Ocelot.Library.DownstreamRouteFinder.UrlMatcher;
|
||||||
using Ocelot.Library.Repository;
|
using Ocelot.Library.HeaderBuilder;
|
||||||
using Ocelot.Library.RequestBuilder;
|
using Ocelot.Library.HeaderBuilder.Middleware;
|
||||||
using Ocelot.Library.Responses;
|
using Ocelot.Library.Responses;
|
||||||
using Ocelot.Library.UrlMatcher;
|
using Ocelot.Library.ScopedData;
|
||||||
using TestStack.BDDfy;
|
using TestStack.BDDfy;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace Ocelot.UnitTests.Middleware
|
namespace Ocelot.UnitTests.HeaderBuilder
|
||||||
{
|
{
|
||||||
public class HttpRequestHeadersBuilderMiddlewareTests : IDisposable
|
public class HttpRequestHeadersBuilderMiddlewareTests : IDisposable
|
||||||
{
|
{
|
@ -1,11 +1,11 @@
|
|||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
|
using Ocelot.Library.ScopedData;
|
||||||
using Shouldly;
|
using Shouldly;
|
||||||
using TestStack.BDDfy;
|
using TestStack.BDDfy;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace Ocelot.UnitTests.Repository
|
namespace Ocelot.UnitTests.Repository
|
||||||
{
|
{
|
||||||
using Library.Repository;
|
|
||||||
using Library.Responses;
|
using Library.Responses;
|
||||||
|
|
||||||
public class ScopedRequestDataRepositoryTests
|
public class ScopedRequestDataRepositoryTests
|
||||||
|
@ -7,16 +7,16 @@ using Microsoft.AspNetCore.Http;
|
|||||||
using Microsoft.AspNetCore.TestHost;
|
using Microsoft.AspNetCore.TestHost;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using Moq;
|
using Moq;
|
||||||
|
using Ocelot.Library.RequestBuilder;
|
||||||
|
using Ocelot.Library.RequestBuilder.Builder;
|
||||||
|
using Ocelot.Library.RequestBuilder.Middleware;
|
||||||
|
using Ocelot.Library.Responses;
|
||||||
|
using Ocelot.Library.ScopedData;
|
||||||
using TestStack.BDDfy;
|
using TestStack.BDDfy;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace Ocelot.UnitTests.Middleware
|
namespace Ocelot.UnitTests.RequestBuilder
|
||||||
{
|
{
|
||||||
using Library.Middleware;
|
|
||||||
using Library.Repository;
|
|
||||||
using Library.RequestBuilder;
|
|
||||||
using Library.Responses;
|
|
||||||
|
|
||||||
public class HttpRequestBuilderMiddlewareTests : IDisposable
|
public class HttpRequestBuilderMiddlewareTests : IDisposable
|
||||||
{
|
{
|
||||||
private readonly Mock<IRequestBuilder> _requestBuilder;
|
private readonly Mock<IRequestBuilder> _requestBuilder;
|
@ -5,6 +5,7 @@ using System.Net;
|
|||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
using Microsoft.AspNetCore.Http.Internal;
|
using Microsoft.AspNetCore.Http.Internal;
|
||||||
|
using Ocelot.Library.RequestBuilder.Builder;
|
||||||
using Shouldly;
|
using Shouldly;
|
||||||
using TestStack.BDDfy;
|
using TestStack.BDDfy;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
@ -6,17 +6,16 @@ using Microsoft.AspNetCore.Hosting;
|
|||||||
using Microsoft.AspNetCore.TestHost;
|
using Microsoft.AspNetCore.TestHost;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using Moq;
|
using Moq;
|
||||||
|
using Ocelot.Library.RequestBuilder;
|
||||||
|
using Ocelot.Library.Requester;
|
||||||
|
using Ocelot.Library.Requester.Middleware;
|
||||||
|
using Ocelot.Library.Responses;
|
||||||
|
using Ocelot.Library.ScopedData;
|
||||||
using TestStack.BDDfy;
|
using TestStack.BDDfy;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace Ocelot.UnitTests.Middleware
|
namespace Ocelot.UnitTests.Requester
|
||||||
{
|
{
|
||||||
using Library.Middleware;
|
|
||||||
using Library.Repository;
|
|
||||||
using Library.RequestBuilder;
|
|
||||||
using Library.Requester;
|
|
||||||
using Library.Responses;
|
|
||||||
|
|
||||||
public class HttpRequesterMiddlewareTests : IDisposable
|
public class HttpRequesterMiddlewareTests : IDisposable
|
||||||
{
|
{
|
||||||
private readonly Mock<IHttpRequester> _requester;
|
private readonly Mock<IHttpRequester> _requester;
|
@ -6,16 +6,15 @@ using Microsoft.AspNetCore.Http;
|
|||||||
using Microsoft.AspNetCore.TestHost;
|
using Microsoft.AspNetCore.TestHost;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using Moq;
|
using Moq;
|
||||||
|
using Ocelot.Library.Responder;
|
||||||
|
using Ocelot.Library.Responder.Middleware;
|
||||||
|
using Ocelot.Library.Responses;
|
||||||
|
using Ocelot.Library.ScopedData;
|
||||||
using TestStack.BDDfy;
|
using TestStack.BDDfy;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace Ocelot.UnitTests.Middleware
|
namespace Ocelot.UnitTests.Responder
|
||||||
{
|
{
|
||||||
using Library.Middleware;
|
|
||||||
using Library.Repository;
|
|
||||||
using Library.Responder;
|
|
||||||
using Library.Responses;
|
|
||||||
|
|
||||||
public class HttpResponderMiddlewareTests : IDisposable
|
public class HttpResponderMiddlewareTests : IDisposable
|
||||||
{
|
{
|
||||||
private readonly Mock<IHttpResponder> _responder;
|
private readonly Mock<IHttpResponder> _responder;
|
Loading…
x
Reference in New Issue
Block a user