mirror of
https://github.com/nsnail/Ocelot.git
synced 2025-06-19 02:58:15 +08:00
removed a bunch of orig files checked in by accident
This commit is contained in:
@ -1,22 +0,0 @@
|
||||
|
||||
namespace Ocelot.Configuration.File
|
||||
{
|
||||
public class FileGlobalConfiguration
|
||||
{
|
||||
public FileGlobalConfiguration()
|
||||
{
|
||||
ServiceDiscoveryProvider = new FileServiceDiscoveryProvider();
|
||||
RateLimitOptions = new FileRateLimitOptions();
|
||||
}
|
||||
|
||||
public string RequestIdKey { get; set; }
|
||||
|
||||
public FileServiceDiscoveryProvider ServiceDiscoveryProvider {get;set;}
|
||||
<<<<<<< HEAD
|
||||
public string AdministrationPath {get;set;}
|
||||
=======
|
||||
|
||||
public FileRateLimitOptions RateLimitOptions { get; set; }
|
||||
>>>>>>> develop
|
||||
}
|
||||
}
|
@ -1,150 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using CacheManager.Core;
|
||||
using IdentityServer4.Models;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Ocelot.Authentication.Handler.Creator;
|
||||
using Ocelot.Authentication.Handler.Factory;
|
||||
using Ocelot.Authorisation;
|
||||
using Ocelot.Cache;
|
||||
using Ocelot.Claims;
|
||||
using Ocelot.Configuration.Authentication;
|
||||
using Ocelot.Configuration.Creator;
|
||||
using Ocelot.Configuration.File;
|
||||
using Ocelot.Configuration.Parser;
|
||||
using Ocelot.Configuration.Provider;
|
||||
using Ocelot.Configuration.Repository;
|
||||
using Ocelot.Configuration.Setter;
|
||||
using Ocelot.Configuration.Validator;
|
||||
using Ocelot.DownstreamRouteFinder.Finder;
|
||||
using Ocelot.DownstreamRouteFinder.UrlMatcher;
|
||||
using Ocelot.DownstreamUrlCreator;
|
||||
using Ocelot.DownstreamUrlCreator.UrlTemplateReplacer;
|
||||
using Ocelot.Headers;
|
||||
using Ocelot.Infrastructure.Claims.Parser;
|
||||
using Ocelot.Infrastructure.RequestData;
|
||||
using Ocelot.LoadBalancer.LoadBalancers;
|
||||
using Ocelot.Logging;
|
||||
using Ocelot.Middleware;
|
||||
using Ocelot.QueryStrings;
|
||||
using Ocelot.Request.Builder;
|
||||
using Ocelot.Requester;
|
||||
using Ocelot.Requester.QoS;
|
||||
using Ocelot.Responder;
|
||||
using Ocelot.ServiceDiscovery;
|
||||
<<<<<<< HEAD
|
||||
using FileConfigurationProvider = Ocelot.Configuration.Provider.FileConfigurationProvider;
|
||||
=======
|
||||
using Ocelot.RateLimit;
|
||||
>>>>>>> develop
|
||||
|
||||
namespace Ocelot.DependencyInjection
|
||||
{
|
||||
public static class ServiceCollectionExtensions
|
||||
{
|
||||
public static IServiceCollection AddOcelotOutputCaching(this IServiceCollection services, Action<ConfigurationBuilderCachePart> settings)
|
||||
{
|
||||
var cacheManagerOutputCache = CacheFactory.Build<HttpResponseMessage>("OcelotOutputCache", settings);
|
||||
var ocelotCacheManager = new OcelotCacheManagerCache<HttpResponseMessage>(cacheManagerOutputCache);
|
||||
services.AddSingleton<ICacheManager<HttpResponseMessage>>(cacheManagerOutputCache);
|
||||
services.AddSingleton<IOcelotCache<HttpResponseMessage>>(ocelotCacheManager);
|
||||
|
||||
return services;
|
||||
}
|
||||
|
||||
public static IServiceCollection AddOcelot(this IServiceCollection services, IConfigurationRoot configurationRoot)
|
||||
{
|
||||
services.Configure<FileConfiguration>(configurationRoot);
|
||||
services.AddSingleton<IOcelotConfigurationCreator, FileOcelotConfigurationCreator>();
|
||||
services.AddSingleton<IOcelotConfigurationRepository, InMemoryOcelotConfigurationRepository>();
|
||||
services.AddSingleton<IConfigurationValidator, FileConfigurationValidator>();
|
||||
services.AddSingleton<IBaseUrlFinder, BaseUrlFinder>();
|
||||
|
||||
var identityServerConfiguration = IdentityServerConfigurationCreator.GetIdentityServerConfiguration();
|
||||
|
||||
if(identityServerConfiguration != null)
|
||||
{
|
||||
services.AddSingleton<IIdentityServerConfiguration>(identityServerConfiguration);
|
||||
services.AddSingleton<IHashMatcher, HashMatcher>();
|
||||
services.AddIdentityServer()
|
||||
.AddTemporarySigningCredential()
|
||||
.AddInMemoryApiResources(new List<ApiResource>
|
||||
{
|
||||
new ApiResource
|
||||
{
|
||||
Name = identityServerConfiguration.ApiName,
|
||||
Description = identityServerConfiguration.Description,
|
||||
Enabled = identityServerConfiguration.Enabled,
|
||||
DisplayName = identityServerConfiguration.ApiName,
|
||||
Scopes = identityServerConfiguration.AllowedScopes.Select(x => new Scope(x)).ToList(),
|
||||
ApiSecrets = new List<Secret>
|
||||
{
|
||||
new Secret
|
||||
{
|
||||
Value = identityServerConfiguration.ApiSecret.Sha256()
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
.AddInMemoryClients(new List<Client>
|
||||
{
|
||||
new Client
|
||||
{
|
||||
ClientId = identityServerConfiguration.ApiName,
|
||||
AllowedGrantTypes = GrantTypes.ResourceOwnerPassword,
|
||||
ClientSecrets = new List<Secret> {new Secret(identityServerConfiguration.ApiSecret.Sha256())},
|
||||
AllowedScopes = identityServerConfiguration.AllowedScopes,
|
||||
AccessTokenType = identityServerConfiguration.AccessTokenType,
|
||||
Enabled = identityServerConfiguration.Enabled,
|
||||
RequireClientSecret = identityServerConfiguration.RequireClientSecret
|
||||
}
|
||||
}).AddResourceOwnerValidator<OcelotResourceOwnerPasswordValidator>();
|
||||
}
|
||||
|
||||
services.AddMvcCore()
|
||||
.AddAuthorization()
|
||||
.AddJsonFormatters();
|
||||
services.AddLogging();
|
||||
services.AddSingleton<IFileConfigurationRepository, FileConfigurationRepository>();
|
||||
services.AddSingleton<IFileConfigurationSetter, FileConfigurationSetter>();
|
||||
services.AddSingleton<IFileConfigurationProvider, FileConfigurationProvider>();
|
||||
services.AddSingleton<IQosProviderHouse, QosProviderHouse>();
|
||||
services.AddSingleton<IQoSProviderFactory, QoSProviderFactory>();
|
||||
services.AddSingleton<IServiceDiscoveryProviderFactory, ServiceDiscoveryProviderFactory>();
|
||||
services.AddSingleton<ILoadBalancerFactory, LoadBalancerFactory>();
|
||||
services.AddSingleton<ILoadBalancerHouse, LoadBalancerHouse>();
|
||||
services.AddSingleton<IOcelotLoggerFactory, AspDotNetLoggerFactory>();
|
||||
services.AddSingleton<IUrlBuilder, UrlBuilder>();
|
||||
services.AddSingleton<IRemoveOutputHeaders, RemoveOutputHeaders>();
|
||||
services.AddSingleton<IOcelotConfigurationProvider, OcelotConfigurationProvider>();
|
||||
services.AddSingleton<IClaimToThingConfigurationParser, ClaimToThingConfigurationParser>();
|
||||
services.AddSingleton<IAuthoriser, ClaimsAuthoriser>();
|
||||
services.AddSingleton<IAddClaimsToRequest, AddClaimsToRequest>();
|
||||
services.AddSingleton<IAddHeadersToRequest, AddHeadersToRequest>();
|
||||
services.AddSingleton<IAddQueriesToRequest, AddQueriesToRequest>();
|
||||
services.AddSingleton<IClaimsParser, ClaimsParser>();
|
||||
services.AddSingleton<IUrlPathToUrlTemplateMatcher, RegExUrlMatcher>();
|
||||
services.AddSingleton<IUrlPathPlaceholderNameAndValueFinder, UrlPathPlaceholderNameAndValueFinder>();
|
||||
services.AddSingleton<IDownstreamPathPlaceholderReplacer, DownstreamTemplatePathPlaceholderReplacer>();
|
||||
services.AddSingleton<IDownstreamRouteFinder, DownstreamRouteFinder.Finder.DownstreamRouteFinder>();
|
||||
services.AddSingleton<IHttpRequester, HttpClientHttpRequester>();
|
||||
services.AddSingleton<IHttpResponder, HttpContextResponder>();
|
||||
services.AddSingleton<IRequestCreator, HttpRequestCreator>();
|
||||
services.AddSingleton<IErrorsToHttpStatusCodeMapper, ErrorsToHttpStatusCodeMapper>();
|
||||
services.AddSingleton<IAuthenticationHandlerFactory, AuthenticationHandlerFactory>();
|
||||
services.AddSingleton<IAuthenticationHandlerCreator, AuthenticationHandlerCreator>();
|
||||
services.AddSingleton<IRateLimitCounterHandler, MemoryCacheRateLimitCounterHandler>();
|
||||
|
||||
// see this for why we register this as singleton http://stackoverflow.com/questions/37371264/invalidoperationexception-unable-to-resolve-service-for-type-microsoft-aspnetc
|
||||
// could maybe use a scoped data repository
|
||||
services.AddSingleton<IHttpContextAccessor, HttpContextAccessor>();
|
||||
services.AddScoped<IRequestScopedDataRepository, HttpDataRepository>();
|
||||
services.AddMemoryCache();
|
||||
return services;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,88 +0,0 @@
|
||||
{
|
||||
"version": "0.0.0-dev",
|
||||
<<<<<<< HEAD
|
||||
"dependencies": {
|
||||
"Microsoft.AspNetCore.Server.IISIntegration": "1.1.0",
|
||||
"Microsoft.Extensions.Configuration.EnvironmentVariables": "1.1.0",
|
||||
"Microsoft.Extensions.Configuration.FileExtensions": "1.1.0",
|
||||
"Microsoft.Extensions.Configuration.Json": "1.1.0",
|
||||
"Microsoft.Extensions.Logging": "1.1.0",
|
||||
"Microsoft.Extensions.Logging.Console": "1.1.0",
|
||||
"Microsoft.Extensions.Logging.Debug": "1.1.0",
|
||||
"Microsoft.Extensions.Options.ConfigurationExtensions": "1.1.0",
|
||||
"Microsoft.AspNetCore.Http": "1.1.0",
|
||||
"System.Text.RegularExpressions": "4.3.0",
|
||||
"Microsoft.AspNetCore.Authentication.OAuth": "1.1.0",
|
||||
"Microsoft.AspNetCore.Authentication.JwtBearer": "1.1.0",
|
||||
"Microsoft.AspNetCore.Authentication.OpenIdConnect": "1.1.0",
|
||||
"Microsoft.AspNetCore.Authentication.Cookies": "1.1.0",
|
||||
"Microsoft.AspNetCore.Authentication.Google": "1.1.0",
|
||||
"Microsoft.AspNetCore.Authentication.Facebook": "1.1.0",
|
||||
"Microsoft.AspNetCore.Authentication.Twitter": "1.1.0",
|
||||
"Microsoft.AspNetCore.Authentication.MicrosoftAccount": "1.1.0",
|
||||
"Microsoft.AspNetCore.Authentication": "1.1.0",
|
||||
"IdentityServer4.AccessTokenValidation": "1.0.2",
|
||||
"Microsoft.AspNetCore.Mvc": "1.1.0",
|
||||
"Microsoft.AspNetCore.Server.Kestrel": "1.1.0",
|
||||
"Microsoft.NETCore.App": "1.1.0",
|
||||
"CacheManager.Core": "0.9.2",
|
||||
"CacheManager.Microsoft.Extensions.Configuration": "0.9.2",
|
||||
"CacheManager.Microsoft.Extensions.Logging": "0.9.2",
|
||||
"Consul": "0.7.2.1",
|
||||
"Polly": "5.0.3",
|
||||
"IdentityServer4": "1.0.1",
|
||||
"Microsoft.AspNetCore.Cryptography.KeyDerivation": "1.1.0"
|
||||
},
|
||||
=======
|
||||
"title": "Ocelot",
|
||||
"summary": "API Gateway created using .NET core.",
|
||||
"projectUrl": "https://github.com/TomPallister/Ocelot",
|
||||
"description": "This project is aimed at people using .NET running a micro services / service orientated architecture that need a unified point of entry into their system. In particular I want easy integration with IdentityServer reference and bearer tokens. We have been unable to find this in my current workplace without having to write our own Javascript middlewares to handle the IdentityServer reference tokens. We would rather use the IdentityServer code that already exists to do this. Ocelot is a bunch of middlewares in a specific order. Ocelot manipulates the HttpRequest object into a state specified by its configuration until it reaches a request builder middleware where it creates a HttpRequestMessage object which is used to make a request to a downstream service. The middleware that makes the request is the last thing in the Ocelot pipeline. It does not call the next middleware. The response from the downstream service is stored in a per request scoped repository and retrived as the requests goes back up the Ocelot pipeline. There is a piece of middleware that maps the HttpResponseMessage onto the HttpResponse object and that is returned to the client. That is basically it with a bunch of other features.",
|
||||
"tags": [
|
||||
"API Gateway",
|
||||
".NET core"
|
||||
],
|
||||
"dependencies": {
|
||||
"Microsoft.AspNetCore.Server.IISIntegration": "1.1.0",
|
||||
"Microsoft.Extensions.Configuration.EnvironmentVariables": "1.1.0",
|
||||
"Microsoft.Extensions.Configuration.FileExtensions": "1.1.0",
|
||||
"Microsoft.Extensions.Configuration.Json": "1.1.0",
|
||||
"Microsoft.Extensions.Logging": "1.1.0",
|
||||
"Microsoft.Extensions.Logging.Console": "1.1.0",
|
||||
"Microsoft.Extensions.Logging.Debug": "1.1.0",
|
||||
"Microsoft.Extensions.Options.ConfigurationExtensions": "1.1.0",
|
||||
"Microsoft.AspNetCore.Http": "1.1.0",
|
||||
"System.Text.RegularExpressions": "4.3.0",
|
||||
"Microsoft.AspNetCore.Authentication.OAuth": "1.1.0",
|
||||
"Microsoft.AspNetCore.Authentication.JwtBearer": "1.1.0",
|
||||
"Microsoft.AspNetCore.Authentication.OpenIdConnect": "1.1.0",
|
||||
"Microsoft.AspNetCore.Authentication.Cookies": "1.1.0",
|
||||
"Microsoft.AspNetCore.Authentication.Google": "1.1.0",
|
||||
"Microsoft.AspNetCore.Authentication.Facebook": "1.1.0",
|
||||
"Microsoft.AspNetCore.Authentication.Twitter": "1.1.0",
|
||||
"Microsoft.AspNetCore.Authentication.MicrosoftAccount": "1.1.0",
|
||||
"Microsoft.AspNetCore.Authentication": "1.1.0",
|
||||
"IdentityServer4.AccessTokenValidation": "1.0.2",
|
||||
"Microsoft.AspNetCore.Mvc": "1.1.0",
|
||||
"Microsoft.AspNetCore.Server.Kestrel": "1.1.0",
|
||||
"Microsoft.NETCore.App": "1.1.0",
|
||||
"CacheManager.Core": "0.9.2",
|
||||
"CacheManager.Microsoft.Extensions.Configuration": "0.9.2",
|
||||
"CacheManager.Microsoft.Extensions.Logging": "0.9.2",
|
||||
"Consul": "0.7.2.1",
|
||||
"Polly": "5.0.3"
|
||||
},
|
||||
>>>>>>> develop
|
||||
"runtimes": {
|
||||
"win10-x64": {},
|
||||
"osx.10.11-x64": {},
|
||||
"osx.10.12-x64": {},
|
||||
"win7-x64": {}
|
||||
},
|
||||
"frameworks": {
|
||||
"netcoreapp1.1": {
|
||||
"imports": [
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user