mirror of
https://github.com/nsnail/Ocelot.git
synced 2025-04-22 14:02:49 +08:00
Removed unused usings, removed empty spaces, removed tons os warnings (#903)
This commit is contained in:
parent
4476f8273e
commit
5d82e68534
@ -1,11 +1,10 @@
|
||||
namespace Ocelot.Administration
|
||||
{
|
||||
using System.Threading.Tasks;
|
||||
using Configuration;
|
||||
using Configuration.Repository;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Ocelot.Middleware;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
public static class IdentityServerMiddlewareConfigurationProvider
|
||||
{
|
||||
|
@ -1,14 +1,6 @@
|
||||
namespace Ocelot.Administration
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IdentityModel.Tokens.Jwt;
|
||||
using System.Linq;
|
||||
using System.Security.Cryptography.X509Certificates;
|
||||
using Configuration;
|
||||
using Configuration.Creator;
|
||||
using DependencyInjection;
|
||||
using IdentityModel;
|
||||
using IdentityServer4.AccessTokenValidation;
|
||||
using IdentityServer4.Models;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
@ -16,6 +8,10 @@
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.DependencyInjection.Extensions;
|
||||
using Ocelot.Middleware;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IdentityModel.Tokens.Jwt;
|
||||
using System.Security.Cryptography.X509Certificates;
|
||||
|
||||
public static class OcelotBuilderExtensions
|
||||
{
|
||||
@ -61,7 +57,8 @@
|
||||
{
|
||||
builder.Services.TryAddSingleton<IIdentityServerConfiguration>(identityServerConfiguration);
|
||||
var identityServerBuilder = builder.Services
|
||||
.AddIdentityServer(o => {
|
||||
.AddIdentityServer(o =>
|
||||
{
|
||||
o.IssuerUri = "Ocelot";
|
||||
})
|
||||
.AddInMemoryApiResources(Resources(identityServerConfiguration))
|
||||
|
@ -1,12 +1,12 @@
|
||||
namespace Ocelot.Cache.CacheManager
|
||||
{
|
||||
using System;
|
||||
using Configuration;
|
||||
using Configuration.File;
|
||||
using DependencyInjection;
|
||||
using global::CacheManager.Core;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.DependencyInjection.Extensions;
|
||||
using System;
|
||||
|
||||
public static class OcelotBuilderExtensions
|
||||
{
|
||||
|
@ -1,7 +1,7 @@
|
||||
namespace Ocelot.Cache.CacheManager
|
||||
{
|
||||
using System;
|
||||
using global::CacheManager.Core;
|
||||
using System;
|
||||
|
||||
public class OcelotCacheManagerCache<T> : IOcelotCache<T>
|
||||
{
|
||||
|
@ -1,16 +1,15 @@
|
||||
namespace Ocelot.Provider.Consul
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using global::Consul;
|
||||
using Infrastructure.Extensions;
|
||||
using Logging;
|
||||
using ServiceDiscovery.Providers;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Values;
|
||||
|
||||
|
||||
public class Consul : IServiceDiscoveryProvider
|
||||
{
|
||||
private readonly ConsulRegistryConfiguration _config;
|
||||
|
@ -1,7 +1,7 @@
|
||||
namespace Ocelot.Provider.Consul
|
||||
{
|
||||
using System;
|
||||
using global::Consul;
|
||||
using System;
|
||||
|
||||
public class ConsulClientFactory : IConsulClientFactory
|
||||
{
|
||||
|
@ -1,14 +1,14 @@
|
||||
namespace Ocelot.Provider.Consul
|
||||
{
|
||||
using System;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Configuration.File;
|
||||
using Configuration.Repository;
|
||||
using global::Consul;
|
||||
using Logging;
|
||||
using Newtonsoft.Json;
|
||||
using Responses;
|
||||
using System;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
public class ConsulFileConfigurationRepository : IFileConfigurationRepository
|
||||
{
|
||||
|
@ -1,8 +1,5 @@
|
||||
namespace Ocelot.Provider.Consul
|
||||
{
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Configuration.Creator;
|
||||
using Configuration.File;
|
||||
using Configuration.Repository;
|
||||
@ -11,6 +8,9 @@
|
||||
using Microsoft.Extensions.Options;
|
||||
using Middleware;
|
||||
using Responses;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
public static class ConsulMiddlewareConfigurationProvider
|
||||
{
|
||||
|
@ -1,8 +1,6 @@
|
||||
namespace Ocelot.Provider.Consul
|
||||
{
|
||||
using System.Threading.Tasks;
|
||||
using Logging;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using ServiceDiscovery;
|
||||
|
||||
|
@ -1,10 +1,10 @@
|
||||
namespace Ocelot.Provider.Consul
|
||||
{
|
||||
using Logging;
|
||||
using ServiceDiscovery.Providers;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Logging;
|
||||
using ServiceDiscovery.Providers;
|
||||
using Values;
|
||||
|
||||
public class PollConsul : IServiceDiscoveryProvider
|
||||
|
@ -1,10 +1,10 @@
|
||||
namespace Ocelot.Provider.Eureka
|
||||
{
|
||||
using ServiceDiscovery.Providers;
|
||||
using Steeltoe.Common.Discovery;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using ServiceDiscovery.Providers;
|
||||
using Steeltoe.Common.Discovery;
|
||||
using Values;
|
||||
|
||||
public class Eureka : IServiceDiscoveryProvider
|
||||
|
@ -1,11 +1,11 @@
|
||||
namespace Ocelot.Provider.Eureka
|
||||
{
|
||||
using System.Threading.Tasks;
|
||||
using Configuration;
|
||||
using Configuration.Repository;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Middleware;
|
||||
using Steeltoe.Discovery.Client;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
public class EurekaMiddlewareConfigurationProvider
|
||||
{
|
||||
|
@ -2,7 +2,6 @@
|
||||
{
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using ServiceDiscovery;
|
||||
using ServiceDiscovery.Providers;
|
||||
using Steeltoe.Common.Discovery;
|
||||
|
||||
public static class EurekaProviderFactory
|
||||
|
@ -1,12 +1,12 @@
|
||||
namespace Ocelot.Provider.Eureka
|
||||
{
|
||||
using System.Linq;
|
||||
using DependencyInjection;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Middleware;
|
||||
using Steeltoe.Discovery.Client;
|
||||
using ServiceDiscovery;
|
||||
using Steeltoe.Discovery.Client;
|
||||
using System.Linq;
|
||||
|
||||
public static class OcelotBuilderExtensions
|
||||
{
|
||||
|
@ -22,7 +22,6 @@ namespace Ocelot.Provider.Kubernetes
|
||||
this.kubeApi = kubeApi;
|
||||
}
|
||||
|
||||
|
||||
public async Task<List<Service>> Get()
|
||||
{
|
||||
var service = await kubeApi.ServicesV1()
|
||||
|
@ -1,7 +1,4 @@
|
||||
using KubeClient;
|
||||
using System;
|
||||
|
||||
namespace Ocelot.Provider.Kubernetes
|
||||
namespace Ocelot.Provider.Kubernetes
|
||||
{
|
||||
public class KubeRegistryConfiguration
|
||||
{
|
||||
|
@ -1,8 +1,6 @@
|
||||
using Polly;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Polly;
|
||||
using Polly.CircuitBreaker;
|
||||
using Polly.Timeout;
|
||||
|
||||
namespace Ocelot.Provider.Polly
|
||||
{
|
||||
|
@ -1,9 +1,5 @@
|
||||
namespace Ocelot.Provider.Polly
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
using Configuration;
|
||||
using DependencyInjection;
|
||||
using Errors;
|
||||
@ -12,6 +8,10 @@
|
||||
using Logging;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Requester;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
public static class OcelotBuilderExtensions
|
||||
{
|
||||
|
@ -1,9 +1,9 @@
|
||||
using System.Net.Http;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Ocelot.Logging;
|
||||
using Polly;
|
||||
using Polly.CircuitBreaker;
|
||||
using System.Net.Http;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Ocelot.Provider.Polly
|
||||
{
|
||||
|
@ -1,12 +1,12 @@
|
||||
namespace Ocelot.Provider.Polly
|
||||
{
|
||||
using System;
|
||||
using System.Net.Http;
|
||||
using global::Polly;
|
||||
using global::Polly.CircuitBreaker;
|
||||
using global::Polly.Timeout;
|
||||
using Ocelot.Configuration;
|
||||
using Ocelot.Logging;
|
||||
using System;
|
||||
using System.Net.Http;
|
||||
|
||||
public class PollyQoSProvider
|
||||
{
|
||||
|
@ -1,7 +1,7 @@
|
||||
namespace Ocelot.Provider.Polly
|
||||
{
|
||||
using System;
|
||||
using Errors;
|
||||
using System;
|
||||
|
||||
public class RequestTimedOutError : Error
|
||||
{
|
||||
|
@ -1,14 +1,13 @@
|
||||
namespace Ocelot.Provider.Rafty
|
||||
{
|
||||
using System.Net.Http;
|
||||
using Configuration;
|
||||
using Administration;
|
||||
using Configuration.Repository;
|
||||
using global::Rafty.Concensus.Peers;
|
||||
using global::Rafty.Infrastructure;
|
||||
using Microsoft.Extensions.Options;
|
||||
using Middleware;
|
||||
using System.Collections.Generic;
|
||||
using Administration;
|
||||
using System.Net.Http;
|
||||
|
||||
public class FilePeersProvider : IPeersProvider
|
||||
{
|
||||
|
@ -1,7 +1,6 @@
|
||||
namespace Ocelot.Provider.Rafty
|
||||
{
|
||||
using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
using Administration;
|
||||
using Configuration;
|
||||
using global::Rafty.Concensus.Messages;
|
||||
using global::Rafty.Concensus.Peers;
|
||||
@ -11,7 +10,8 @@
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Administration;
|
||||
using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
public class HttpPeer : IPeer
|
||||
{
|
||||
|
@ -1,9 +1,9 @@
|
||||
namespace Ocelot.Provider.Rafty
|
||||
{
|
||||
using System.Threading.Tasks;
|
||||
using Configuration.Setter;
|
||||
using global::Rafty.FiniteStateMachine;
|
||||
using global::Rafty.Log;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
public class OcelotFiniteStateMachine : IFiniteStateMachine
|
||||
{
|
||||
|
@ -1,8 +1,5 @@
|
||||
namespace Ocelot.Provider.Rafty
|
||||
{
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
using global::Rafty.Concensus.Messages;
|
||||
using global::Rafty.Concensus.Node;
|
||||
using global::Rafty.FiniteStateMachine;
|
||||
@ -11,6 +8,9 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Middleware;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
[Authorize]
|
||||
[Route("raft")]
|
||||
|
@ -1,10 +1,10 @@
|
||||
namespace Ocelot.Provider.Rafty
|
||||
{
|
||||
using System.Threading.Tasks;
|
||||
using Configuration.File;
|
||||
using Configuration.Setter;
|
||||
using global::Rafty.Concensus.Node;
|
||||
using global::Rafty.Infrastructure;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
public class RaftyFileConfigurationSetter : IFileConfigurationSetter
|
||||
{
|
||||
|
@ -1,12 +1,12 @@
|
||||
namespace Ocelot.Provider.Rafty
|
||||
{
|
||||
using System.Threading.Tasks;
|
||||
using global::Rafty.Concensus.Node;
|
||||
using global::Rafty.Infrastructure;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Middleware;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
public static class RaftyMiddlewareConfigurationProvider
|
||||
{
|
||||
|
@ -1,15 +1,15 @@
|
||||
namespace Ocelot.Provider.Rafty
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using global::Rafty.Infrastructure;
|
||||
using global::Rafty.Log;
|
||||
using Microsoft.Data.Sqlite;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
public class SqlLiteLog : ILog
|
||||
{
|
||||
|
@ -1,6 +1,7 @@
|
||||
namespace Ocelot.Provider.Rafty
|
||||
{
|
||||
using Errors;
|
||||
|
||||
public class UnableToSaveAcceptCommand : Error
|
||||
{
|
||||
public UnableToSaveAcceptCommand(string message)
|
||||
|
@ -1,17 +1,17 @@
|
||||
namespace Ocelot.Tracing.Butterfly
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using global::Butterfly.Client.AspNetCore;
|
||||
using global::Butterfly.Client.Tracing;
|
||||
using global::Butterfly.OpenTracing;
|
||||
using Infrastructure.Extensions;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
public class ButterflyTracer : DelegatingHandler, Logging.ITracer
|
||||
{
|
||||
|
@ -1,10 +1,10 @@
|
||||
namespace Ocelot.Tracing.Butterfly
|
||||
{
|
||||
using System;
|
||||
using DependencyInjection;
|
||||
using global::Butterfly.Client.AspNetCore;
|
||||
using Logging;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using System;
|
||||
|
||||
public static class OcelotBuilderExtensions
|
||||
{
|
||||
|
@ -1,11 +1,8 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Authentication;
|
||||
using Microsoft.AspNetCore.Authentication;
|
||||
using Ocelot.Configuration;
|
||||
using Ocelot.Errors;
|
||||
using Ocelot.Infrastructure.Extensions;
|
||||
using Ocelot.Logging;
|
||||
using Ocelot.Middleware;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Ocelot.Authentication.Middleware
|
||||
{
|
||||
|
@ -1,14 +1,10 @@
|
||||
using System;
|
||||
using Ocelot.DownstreamRouteFinder.UrlMatcher;
|
||||
using Ocelot.Responses;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Security.Claims;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
using Ocelot.DownstreamRouteFinder.UrlMatcher;
|
||||
using Ocelot.Middleware;
|
||||
using Ocelot.Responses;
|
||||
using Ocelot.Values;
|
||||
|
||||
namespace Ocelot.Authorisation
|
||||
{
|
||||
using Infrastructure.Claims.Parser;
|
||||
@ -26,7 +22,8 @@ namespace Ocelot.Authorisation
|
||||
ClaimsPrincipal claimsPrincipal,
|
||||
Dictionary<string, string> routeClaimsRequirement,
|
||||
List<PlaceholderNameAndValue> urlPathPlaceholderNameAndValues
|
||||
){
|
||||
)
|
||||
{
|
||||
foreach (var required in routeClaimsRequirement)
|
||||
{
|
||||
var values = _claimsParser.GetValuesByClaimType(claimsPrincipal.Claims, required.Key);
|
||||
@ -70,7 +67,6 @@ namespace Ocelot.Authorisation
|
||||
$"config error: requires variable claim value: {required.Value} but placeholders are ambiguous: {string.Join(", ", urlPathPlaceholderNameAndValues.Where(p => p.Name.Equals(variableName)).Select(p => p.Value))}"));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1,9 +1,6 @@
|
||||
using System.Security.Claims;
|
||||
|
||||
using Ocelot.Configuration;
|
||||
using Ocelot.DownstreamRouteFinder.UrlMatcher;
|
||||
using Ocelot.DownstreamRouteFinder.UrlMatcher;
|
||||
using Ocelot.Responses;
|
||||
using Ocelot.Values;
|
||||
using System.Security.Claims;
|
||||
|
||||
namespace Ocelot.Authorisation
|
||||
{
|
||||
|
@ -1,5 +1,5 @@
|
||||
using System.Security.Claims;
|
||||
using Ocelot.Responses;
|
||||
using Ocelot.Responses;
|
||||
using System.Security.Claims;
|
||||
|
||||
namespace Ocelot.Authorisation
|
||||
{
|
||||
|
@ -1,12 +1,10 @@
|
||||
namespace Ocelot.Authorisation.Middleware
|
||||
{
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using Errors;
|
||||
using Ocelot.Middleware;
|
||||
using Logging;
|
||||
using Responses;
|
||||
using Configuration;
|
||||
using Logging;
|
||||
using Ocelot.Middleware;
|
||||
using Responses;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
public class AuthorisationMiddleware : OcelotMiddleware
|
||||
{
|
||||
|
@ -1,7 +1,7 @@
|
||||
using Ocelot.Responses;
|
||||
using System.Collections.Generic;
|
||||
using System.Security.Claims;
|
||||
using System.Linq;
|
||||
using System.Security.Claims;
|
||||
|
||||
namespace Ocelot.Authorisation
|
||||
{
|
||||
|
@ -1,13 +1,17 @@
|
||||
using System.Text;
|
||||
using Ocelot.Middleware;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Ocelot.Middleware;
|
||||
|
||||
namespace Ocelot.Cache {
|
||||
public class CacheKeyGenerator : ICacheKeyGenerator {
|
||||
public string GenerateRequestCacheKey(DownstreamContext context) {
|
||||
namespace Ocelot.Cache
|
||||
{
|
||||
public class CacheKeyGenerator : ICacheKeyGenerator
|
||||
{
|
||||
public string GenerateRequestCacheKey(DownstreamContext context)
|
||||
{
|
||||
string hashedContent = null;
|
||||
StringBuilder downStreamUrlKeyBuilder = new StringBuilder($"{context.DownstreamRequest.Method}-{context.DownstreamRequest.OriginalString}");
|
||||
if (context.DownstreamRequest.Content != null) {
|
||||
if (context.DownstreamRequest.Content != null)
|
||||
{
|
||||
string requestContentString = Task.Run(async () => await context.DownstreamRequest.Content.ReadAsStringAsync()).Result;
|
||||
downStreamUrlKeyBuilder.Append(requestContentString);
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
{
|
||||
using System;
|
||||
|
||||
class CacheObject<T>
|
||||
internal class CacheObject<T>
|
||||
{
|
||||
public CacheObject(T value, DateTime expires)
|
||||
{
|
||||
|
@ -1,7 +1,9 @@
|
||||
using Ocelot.Middleware;
|
||||
|
||||
namespace Ocelot.Cache {
|
||||
public interface ICacheKeyGenerator {
|
||||
namespace Ocelot.Cache
|
||||
{
|
||||
public interface ICacheKeyGenerator
|
||||
{
|
||||
string GenerateRequestCacheKey(DownstreamContext context);
|
||||
}
|
||||
}
|
||||
|
@ -5,8 +5,11 @@ namespace Ocelot.Cache
|
||||
public interface IOcelotCache<T>
|
||||
{
|
||||
void Add(string key, T value, TimeSpan ttl, string region);
|
||||
|
||||
T Get(string key, string region);
|
||||
|
||||
void ClearRegion(string region);
|
||||
|
||||
void AddAndDelete(string key, T value, TimeSpan ttl, string region);
|
||||
}
|
||||
}
|
||||
|
@ -1,20 +1,25 @@
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
|
||||
namespace Ocelot.Cache {
|
||||
public static class MD5Helper {
|
||||
public static string GenerateMd5(byte[] contentBytes) {
|
||||
namespace Ocelot.Cache
|
||||
{
|
||||
public static class MD5Helper
|
||||
{
|
||||
public static string GenerateMd5(byte[] contentBytes)
|
||||
{
|
||||
MD5 md5 = MD5.Create();
|
||||
byte[] hash = md5.ComputeHash(contentBytes);
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (int i = 0; i < hash.Length; i++) {
|
||||
for (int i = 0; i < hash.Length; i++)
|
||||
{
|
||||
sb.Append(hash[i].ToString("X2"));
|
||||
}
|
||||
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
public static string GenerateMd5(string contentString) {
|
||||
public static string GenerateMd5(string contentString)
|
||||
{
|
||||
byte[] contentBytes = Encoding.Unicode.GetBytes(contentString);
|
||||
return GenerateMd5(contentBytes);
|
||||
}
|
||||
|
@ -1,13 +1,13 @@
|
||||
namespace Ocelot.Cache.Middleware
|
||||
{
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
using Ocelot.Logging;
|
||||
using Ocelot.Middleware;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
public class OutputCacheMiddleware : OcelotMiddleware
|
||||
{
|
||||
@ -77,10 +77,12 @@
|
||||
context.DownstreamResponse = response;
|
||||
}
|
||||
|
||||
private string GenerateRequestCacheKey(DownstreamContext context) {
|
||||
private string GenerateRequestCacheKey(DownstreamContext context)
|
||||
{
|
||||
string hashedContent = null;
|
||||
StringBuilder downStreamUrlKeyBuilder = new StringBuilder($"{context.DownstreamRequest.Method}-{context.DownstreamRequest.OriginalString}");
|
||||
if(context.DownstreamRequest.Content != null) {
|
||||
if (context.DownstreamRequest.Content != null)
|
||||
{
|
||||
string requestContentString = Task.Run(async () => await context.DownstreamRequest.Content?.ReadAsStringAsync()).Result;
|
||||
downStreamUrlKeyBuilder.Append(requestContentString);
|
||||
}
|
||||
|
@ -1,6 +1,5 @@
|
||||
using System.Linq;
|
||||
using Ocelot.Configuration;
|
||||
using Ocelot.Configuration.File;
|
||||
using System.Linq;
|
||||
|
||||
namespace Ocelot.Cache
|
||||
{
|
||||
|
@ -1,10 +1,10 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Security.Claims;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Ocelot.Configuration;
|
||||
using Ocelot.Infrastructure.Claims.Parser;
|
||||
using Ocelot.Responses;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Security.Claims;
|
||||
|
||||
namespace Ocelot.Claims
|
||||
{
|
||||
|
@ -1,7 +1,7 @@
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Ocelot.Configuration;
|
||||
using Ocelot.Responses;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Ocelot.Claims
|
||||
{
|
||||
|
@ -1,10 +1,7 @@
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Ocelot.DownstreamRouteFinder.Middleware;
|
||||
using Ocelot.Infrastructure.RequestData;
|
||||
using Ocelot.Logging;
|
||||
using Ocelot.Logging;
|
||||
using Ocelot.Middleware;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Ocelot.Claims.Middleware
|
||||
{
|
||||
|
@ -1,8 +1,8 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Net.Http;
|
||||
using Ocelot.Values;
|
||||
using System.Linq;
|
||||
using Ocelot.Configuration.Creator;
|
||||
using Ocelot.Values;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
|
||||
namespace Ocelot.Configuration.Builder
|
||||
{
|
||||
@ -39,6 +39,7 @@ namespace Ocelot.Configuration.Builder
|
||||
private List<AddHeader> _addHeadersToUpstream;
|
||||
private bool _dangerousAcceptAnyServerCertificateValidator;
|
||||
private SecurityOptions _securityOptions;
|
||||
|
||||
public DownstreamReRouteBuilder()
|
||||
{
|
||||
_downstreamAddresses = new List<DownstreamHostAndPort>();
|
||||
|
@ -1,10 +1,10 @@
|
||||
namespace Ocelot.Configuration.Builder
|
||||
{
|
||||
using System.Collections.Generic;
|
||||
using System.Net.Http;
|
||||
using Ocelot.Values;
|
||||
using System.Linq;
|
||||
using Ocelot.Configuration.File;
|
||||
using Ocelot.Values;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
|
||||
public class ReRouteBuilder
|
||||
{
|
||||
|
@ -1,9 +1,9 @@
|
||||
namespace Ocelot.Configuration.Creator
|
||||
{
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Builder;
|
||||
using File;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
public class AggregatesCreator : IAggregatesCreator
|
||||
{
|
||||
|
@ -1,6 +1,6 @@
|
||||
using System.Collections.Generic;
|
||||
using Ocelot.Configuration.Parser;
|
||||
using Ocelot.Logging;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Ocelot.Configuration.Creator
|
||||
{
|
||||
|
@ -1,10 +1,10 @@
|
||||
namespace Ocelot.Configuration.Creator
|
||||
{
|
||||
using DependencyInjection;
|
||||
using File;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using File;
|
||||
using DependencyInjection;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
public class ConfigurationCreator : IConfigurationCreator
|
||||
{
|
||||
|
@ -1,6 +1,6 @@
|
||||
using Ocelot.Configuration.File;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Ocelot.Configuration.File;
|
||||
|
||||
namespace Ocelot.Configuration.Creator
|
||||
{
|
||||
|
@ -1,9 +1,9 @@
|
||||
namespace Ocelot.Configuration.Creator
|
||||
{
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Builder;
|
||||
using File;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
public class DynamicsCreator : IDynamicsCreator
|
||||
{
|
||||
|
@ -1,10 +1,10 @@
|
||||
namespace Ocelot.Configuration.Creator
|
||||
{
|
||||
using File;
|
||||
using Responses;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using File;
|
||||
using Validator;
|
||||
using Responses;
|
||||
|
||||
public class FileInternalConfigurationCreator : IInternalConfigurationCreator
|
||||
{
|
||||
|
@ -1,11 +1,9 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Ocelot.Configuration.File;
|
||||
using Ocelot.Infrastructure;
|
||||
using Ocelot.Infrastructure.Extensions;
|
||||
using Ocelot.Logging;
|
||||
using Ocelot.Middleware;
|
||||
using Ocelot.Responses;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Ocelot.Configuration.Creator
|
||||
{
|
||||
|
@ -1,9 +1,9 @@
|
||||
namespace Ocelot.Configuration.Creator
|
||||
{
|
||||
using System;
|
||||
using Logging;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Ocelot.Configuration.File;
|
||||
using System;
|
||||
|
||||
public class HttpHandlerOptionsCreator : IHttpHandlerOptionsCreator
|
||||
{
|
||||
|
@ -1,5 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using Ocelot.Configuration.File;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Ocelot.Configuration.Creator
|
||||
{
|
||||
|
@ -1,4 +1,3 @@
|
||||
using System.Collections.Generic;
|
||||
using Ocelot.Configuration.File;
|
||||
|
||||
namespace Ocelot.Configuration.Creator
|
||||
|
@ -1,5 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using Ocelot.Configuration.File;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Ocelot.Configuration.Creator
|
||||
{
|
||||
|
@ -1,5 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using Ocelot.Configuration.File;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Ocelot.Configuration.Creator
|
||||
{
|
||||
|
@ -1,5 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using Ocelot.Configuration.File;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Ocelot.Configuration.Creator
|
||||
{
|
||||
|
@ -1,4 +1,3 @@
|
||||
using System.Collections.Generic;
|
||||
using Ocelot.Configuration.File;
|
||||
|
||||
namespace Ocelot.Configuration.Creator
|
||||
|
@ -1,6 +1,6 @@
|
||||
using System.Threading.Tasks;
|
||||
using Ocelot.Configuration.File;
|
||||
using Ocelot.Responses;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Ocelot.Configuration.Creator
|
||||
{
|
||||
|
@ -1,12 +1,14 @@
|
||||
using System.Collections.Generic;
|
||||
using Ocelot.Configuration.File;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Ocelot.Configuration.Creator
|
||||
{
|
||||
public interface IQoSOptionsCreator
|
||||
{
|
||||
QoSOptions Create(FileQoSOptions options);
|
||||
|
||||
QoSOptions Create(FileQoSOptions options, string pathTemplate, List<string> httpMethods);
|
||||
|
||||
QoSOptions Create(QoSOptions options, string pathTemplate, List<string> httpMethods);
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using Ocelot.Configuration.File;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Ocelot.Configuration.Creator
|
||||
{
|
||||
|
@ -1,7 +1,4 @@
|
||||
using Ocelot.Configuration.File;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Ocelot.Configuration.Creator
|
||||
{
|
||||
|
@ -1,6 +1,6 @@
|
||||
using System.Linq;
|
||||
using Ocelot.Configuration.File;
|
||||
using Ocelot.LoadBalancer.LoadBalancers;
|
||||
using System.Linq;
|
||||
|
||||
namespace Ocelot.Configuration.Creator
|
||||
{
|
||||
|
@ -1,10 +1,10 @@
|
||||
namespace Ocelot.Configuration.Creator
|
||||
{
|
||||
using Builder;
|
||||
using Cache;
|
||||
using File;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Cache;
|
||||
using Builder;
|
||||
using File;
|
||||
|
||||
public class ReRoutesCreator : IReRoutesCreator
|
||||
{
|
||||
|
@ -1,7 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using Ocelot.Configuration.File;
|
||||
using Ocelot.Configuration.File;
|
||||
|
||||
namespace Ocelot.Configuration.Creator
|
||||
{
|
||||
|
@ -1,6 +1,6 @@
|
||||
using System.Collections.Generic;
|
||||
using Ocelot.Configuration.File;
|
||||
using Ocelot.Values;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Ocelot.Configuration.Creator
|
||||
{
|
||||
|
@ -1,7 +1,7 @@
|
||||
namespace Ocelot.Configuration
|
||||
{
|
||||
using System.Collections.Generic;
|
||||
using Creator;
|
||||
using System.Collections.Generic;
|
||||
using Values;
|
||||
|
||||
public class DownstreamReRoute
|
||||
|
@ -1,8 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Ocelot.Configuration.File
|
||||
namespace Ocelot.Configuration.File
|
||||
{
|
||||
public class AggregateReRouteConfig
|
||||
{
|
||||
|
@ -1,6 +1,6 @@
|
||||
using System.Collections.Generic;
|
||||
using Ocelot.Infrastructure.Extensions;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using Ocelot.Infrastructure.Extensions;
|
||||
|
||||
namespace Ocelot.Configuration.File
|
||||
{
|
||||
|
@ -17,6 +17,7 @@ namespace Ocelot.Configuration.File
|
||||
|
||||
// Seperate field for aggregates because this let's you re-use ReRoutes in multiple Aggregates
|
||||
public List<FileAggregateReRoute> Aggregates { get; set; }
|
||||
|
||||
public FileGlobalConfiguration GlobalConfiguration { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -1,9 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Ocelot.Configuration.File
|
||||
namespace Ocelot.Configuration.File
|
||||
{
|
||||
public class FileRateLimitOptions
|
||||
{
|
||||
|
@ -1,9 +1,6 @@
|
||||
using System;
|
||||
using Ocelot.Infrastructure.Extensions;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Ocelot.Infrastructure.Extensions;
|
||||
|
||||
namespace Ocelot.Configuration.File
|
||||
{
|
||||
|
@ -1,6 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Ocelot.Configuration.File
|
||||
{
|
||||
|
@ -1,9 +1,9 @@
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Ocelot.Configuration.File;
|
||||
using Ocelot.Configuration.Setter;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Ocelot.Configuration
|
||||
{
|
||||
|
@ -1,8 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Ocelot.Responses;
|
||||
using System;
|
||||
using System.Text.RegularExpressions;
|
||||
using Ocelot.Errors;
|
||||
using Ocelot.Responses;
|
||||
|
||||
namespace Ocelot.Configuration.Parser
|
||||
{
|
||||
|
@ -1,5 +1,5 @@
|
||||
using System;
|
||||
using Ocelot.Errors;
|
||||
using Ocelot.Errors;
|
||||
using System;
|
||||
|
||||
namespace Ocelot.Configuration.Parser
|
||||
{
|
||||
|
@ -1,6 +1,4 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Ocelot.Configuration
|
||||
{
|
||||
|
@ -1,6 +1,4 @@
|
||||
using System;
|
||||
|
||||
namespace Ocelot.Configuration
|
||||
namespace Ocelot.Configuration
|
||||
{
|
||||
public class RateLimitRule
|
||||
{
|
||||
|
@ -1,9 +1,9 @@
|
||||
namespace Ocelot.Configuration
|
||||
{
|
||||
using System.Collections.Generic;
|
||||
using System.Net.Http;
|
||||
using Ocelot.Configuration.File;
|
||||
using Ocelot.Values;
|
||||
using System.Collections.Generic;
|
||||
using System.Net.Http;
|
||||
|
||||
public class ReRoute
|
||||
{
|
||||
|
@ -1,33 +1,40 @@
|
||||
using System.Threading.Tasks;
|
||||
using Ocelot.Responses;
|
||||
using Ocelot.Responses;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Ocelot.Configuration.Repository {
|
||||
public class ConsulFileConfigurationPollerOption : IFileConfigurationPollerOptions {
|
||||
namespace Ocelot.Configuration.Repository
|
||||
{
|
||||
public class ConsulFileConfigurationPollerOption : IFileConfigurationPollerOptions
|
||||
{
|
||||
private readonly IInternalConfigurationRepository _internalConfigRepo;
|
||||
private readonly IFileConfigurationRepository _fileConfigurationRepository;
|
||||
|
||||
public ConsulFileConfigurationPollerOption(IInternalConfigurationRepository internalConfigurationRepository,
|
||||
IFileConfigurationRepository fileConfigurationRepository) {
|
||||
IFileConfigurationRepository fileConfigurationRepository)
|
||||
{
|
||||
_internalConfigRepo = internalConfigurationRepository;
|
||||
_fileConfigurationRepository = fileConfigurationRepository;
|
||||
}
|
||||
|
||||
public int Delay => GetDelay();
|
||||
|
||||
private int GetDelay() {
|
||||
private int GetDelay()
|
||||
{
|
||||
int delay = 1000;
|
||||
|
||||
Response<File.FileConfiguration> fileConfig = Task.Run(async () => await _fileConfigurationRepository.Get()).Result;
|
||||
if (fileConfig?.Data?.GlobalConfiguration?.ServiceDiscoveryProvider != null &&
|
||||
!fileConfig.IsError &&
|
||||
fileConfig.Data.GlobalConfiguration.ServiceDiscoveryProvider.PollingInterval > 0) {
|
||||
fileConfig.Data.GlobalConfiguration.ServiceDiscoveryProvider.PollingInterval > 0)
|
||||
{
|
||||
delay = fileConfig.Data.GlobalConfiguration.ServiceDiscoveryProvider.PollingInterval;
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
Response<IInternalConfiguration> internalConfig = _internalConfigRepo.Get();
|
||||
if (internalConfig?.Data?.ServiceProviderConfiguration != null &&
|
||||
!internalConfig.IsError &&
|
||||
internalConfig.Data.ServiceProviderConfiguration.PollingInterval > 0) {
|
||||
internalConfig.Data.ServiceProviderConfiguration.PollingInterval > 0)
|
||||
{
|
||||
delay = internalConfig.Data.ServiceProviderConfiguration.PollingInterval;
|
||||
}
|
||||
}
|
||||
|
@ -1,9 +1,9 @@
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Newtonsoft.Json;
|
||||
using Ocelot.Configuration.File;
|
||||
using Ocelot.Responses;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Ocelot.Configuration.Repository
|
||||
{
|
||||
|
@ -1,13 +1,12 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using Newtonsoft.Json;
|
||||
using Ocelot.Configuration.Creator;
|
||||
using Ocelot.Configuration.File;
|
||||
using Ocelot.Configuration.Setter;
|
||||
using Ocelot.Logging;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Ocelot.Configuration.Repository
|
||||
{
|
||||
|
@ -1,12 +1,13 @@
|
||||
using System.Threading.Tasks;
|
||||
using Ocelot.Configuration.File;
|
||||
using Ocelot.Responses;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Ocelot.Configuration.Repository
|
||||
{
|
||||
public interface IFileConfigurationRepository
|
||||
{
|
||||
Task<Response<FileConfiguration>> Get();
|
||||
|
||||
Task<Response> Set(FileConfiguration fileConfiguration);
|
||||
}
|
||||
}
|
@ -5,6 +5,7 @@ namespace Ocelot.Configuration.Repository
|
||||
public interface IInternalConfigurationRepository
|
||||
{
|
||||
Response<IInternalConfiguration> Get();
|
||||
|
||||
Response AddOrReplace(IInternalConfiguration internalConfiguration);
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Ocelot.Configuration
|
||||
{
|
||||
|
@ -1,8 +1,8 @@
|
||||
using System.Threading.Tasks;
|
||||
using Ocelot.Configuration.Creator;
|
||||
using Ocelot.Configuration.File;
|
||||
using Ocelot.Configuration.Repository;
|
||||
using Ocelot.Responses;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Ocelot.Configuration.Setter
|
||||
{
|
||||
|
@ -1,6 +1,6 @@
|
||||
using System.Threading.Tasks;
|
||||
using Ocelot.Configuration.File;
|
||||
using Ocelot.Responses;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Ocelot.Configuration.Setter
|
||||
{
|
||||
|
@ -1,7 +1,7 @@
|
||||
namespace Ocelot.Configuration.Validator
|
||||
{
|
||||
using System.Collections.Generic;
|
||||
using Ocelot.Errors;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public class ConfigurationValidationResult
|
||||
{
|
||||
|
@ -1,15 +1,15 @@
|
||||
namespace Ocelot.Configuration.Validator
|
||||
{
|
||||
using FluentValidation;
|
||||
using File;
|
||||
using Errors;
|
||||
using File;
|
||||
using FluentValidation;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Responses;
|
||||
using ServiceDiscovery;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using ServiceDiscovery;
|
||||
|
||||
public class FileConfigurationFluentValidator : AbstractValidator<FileConfiguration>, IConfigurationValidator
|
||||
{
|
||||
|
@ -1,7 +1,7 @@
|
||||
namespace Ocelot.Configuration.Validator
|
||||
{
|
||||
using FluentValidation;
|
||||
using File;
|
||||
using FluentValidation;
|
||||
|
||||
public class FileGlobalConfigurationFluentValidator : AbstractValidator<FileGlobalConfiguration>
|
||||
{
|
||||
|
@ -1,10 +1,10 @@
|
||||
namespace Ocelot.Configuration.Validator
|
||||
{
|
||||
using System;
|
||||
using FluentValidation;
|
||||
using File;
|
||||
using FluentValidation;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Requester;
|
||||
using System;
|
||||
|
||||
public class FileQoSOptionsFluentValidator : AbstractValidator<FileQoSOptions>
|
||||
{
|
||||
@ -14,7 +14,8 @@ namespace Ocelot.Configuration.Validator
|
||||
{
|
||||
_qosDelegatingHandlerDelegate = provider.GetService<QosDelegatingHandlerDelegate>();
|
||||
|
||||
When(qosOptions => qosOptions.TimeoutValue > 0 && qosOptions.ExceptionsAllowedBeforeBreaking > 0, () => {
|
||||
When(qosOptions => qosOptions.TimeoutValue > 0 && qosOptions.ExceptionsAllowedBeforeBreaking > 0, () =>
|
||||
{
|
||||
RuleFor(qosOptions => qosOptions)
|
||||
.Must(HaveQosHandlerRegistered)
|
||||
.WithMessage("Unable to start Ocelot because either a ReRoute or GlobalConfiguration are using QoSOptions but no QosDelegatingHandlerDelegate has been registered in dependency injection container. Are you missing a package like Ocelot.Provider.Polly and services.AddPolly()?");
|
||||
|
@ -1,8 +1,8 @@
|
||||
namespace Ocelot.Configuration.Validator
|
||||
{
|
||||
using System.Threading.Tasks;
|
||||
using Ocelot.Configuration.File;
|
||||
using Ocelot.Responses;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
public interface IConfigurationValidator
|
||||
{
|
||||
|
@ -1,9 +1,8 @@
|
||||
namespace Ocelot.Configuration.Validator
|
||||
{
|
||||
using System;
|
||||
using File;
|
||||
using FluentValidation;
|
||||
using Microsoft.AspNetCore.Authentication;
|
||||
using File;
|
||||
using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading;
|
||||
@ -73,12 +72,14 @@
|
||||
.MustAsync(IsSupportedAuthenticationProviders)
|
||||
.WithMessage("{PropertyName} {PropertyValue} is unsupported authentication provider");
|
||||
|
||||
When(reRoute => string.IsNullOrEmpty(reRoute.ServiceName), () => {
|
||||
When(reRoute => string.IsNullOrEmpty(reRoute.ServiceName), () =>
|
||||
{
|
||||
RuleFor(r => r.DownstreamHostAndPorts).NotEmpty()
|
||||
.WithMessage("When not using service discovery DownstreamHostAndPorts must be set and not empty or Ocelot cannot find your service!");
|
||||
});
|
||||
|
||||
When(reRoute => string.IsNullOrEmpty(reRoute.ServiceName), () => {
|
||||
When(reRoute => string.IsNullOrEmpty(reRoute.ServiceName), () =>
|
||||
{
|
||||
RuleFor(reRoute => reRoute.DownstreamHostAndPorts)
|
||||
.SetCollectionValidator(hostAndPortValidator);
|
||||
});
|
||||
|
@ -1,15 +1,15 @@
|
||||
namespace Ocelot.DependencyInjection
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Configuration.File;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.Configuration.Memory;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
using Configuration.File;
|
||||
using Newtonsoft.Json;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
|
||||
public static class ConfigurationBuilderExtensions
|
||||
{
|
||||
|
@ -1,8 +1,7 @@
|
||||
using System;
|
||||
using System.Net.Http;
|
||||
using Ocelot.Middleware.Multiplexer;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Ocelot.Middleware.Multiplexer;
|
||||
using System.Net.Http;
|
||||
|
||||
namespace Ocelot.DependencyInjection
|
||||
{
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user