diff --git a/src/Ocelot.Library/Infrastructure/Authentication/AuthenticationProviderFactory.cs b/src/Ocelot.Library/Infrastructure/Authentication/AuthenticationHandlerFactory.cs similarity index 85% rename from src/Ocelot.Library/Infrastructure/Authentication/AuthenticationProviderFactory.cs rename to src/Ocelot.Library/Infrastructure/Authentication/AuthenticationHandlerFactory.cs index 770462ca..eaa8837b 100644 --- a/src/Ocelot.Library/Infrastructure/Authentication/AuthenticationProviderFactory.cs +++ b/src/Ocelot.Library/Infrastructure/Authentication/AuthenticationHandlerFactory.cs @@ -5,11 +5,11 @@ using Ocelot.Library.Infrastructure.Responses; namespace Ocelot.Library.Infrastructure.Authentication { - public class AuthenticationProviderFactory : IAuthenticationProviderFactory + public class AuthenticationHandlerFactory : IAuthenticationHandlerFactory { private readonly IAuthenticationHandlerCreator _creator; - public AuthenticationProviderFactory(IAuthenticationHandlerCreator creator) + public AuthenticationHandlerFactory(IAuthenticationHandlerCreator creator) { _creator = creator; } diff --git a/src/Ocelot.Library/Infrastructure/Authentication/IAuthenticationProviderFactory.cs b/src/Ocelot.Library/Infrastructure/Authentication/IAuthenticationHandlerFactory.cs similarity index 82% rename from src/Ocelot.Library/Infrastructure/Authentication/IAuthenticationProviderFactory.cs rename to src/Ocelot.Library/Infrastructure/Authentication/IAuthenticationHandlerFactory.cs index e9a25a54..6fc2af29 100644 --- a/src/Ocelot.Library/Infrastructure/Authentication/IAuthenticationProviderFactory.cs +++ b/src/Ocelot.Library/Infrastructure/Authentication/IAuthenticationHandlerFactory.cs @@ -3,7 +3,7 @@ using Ocelot.Library.Infrastructure.Responses; namespace Ocelot.Library.Infrastructure.Authentication { - public interface IAuthenticationProviderFactory + public interface IAuthenticationHandlerFactory { Response Get(string provider, IApplicationBuilder app); } diff --git a/src/Ocelot.Library/Infrastructure/Middleware/AuthenticationMiddleware.cs b/src/Ocelot.Library/Infrastructure/Middleware/AuthenticationMiddleware.cs index be8f54be..896d1be3 100644 --- a/src/Ocelot.Library/Infrastructure/Middleware/AuthenticationMiddleware.cs +++ b/src/Ocelot.Library/Infrastructure/Middleware/AuthenticationMiddleware.cs @@ -22,15 +22,15 @@ namespace Ocelot.Library.Infrastructure.Middleware private RequestDelegate _authenticationNext; private readonly IScopedRequestDataRepository _scopedRequestDataRepository; private readonly IApplicationBuilder _app; - private readonly IAuthenticationProviderFactory _authProviderFactory; + private readonly IAuthenticationHandlerFactory _authHandlerFactory; public AuthenticationMiddleware(RequestDelegate next, IApplicationBuilder app, - IScopedRequestDataRepository scopedRequestDataRepository, IAuthenticationProviderFactory authProviderFactory) + IScopedRequestDataRepository scopedRequestDataRepository, IAuthenticationHandlerFactory authHandlerFactory) : base(scopedRequestDataRepository) { _next = next; _scopedRequestDataRepository = scopedRequestDataRepository; - _authProviderFactory = authProviderFactory; + _authHandlerFactory = authHandlerFactory; _app = app; } @@ -46,7 +46,7 @@ namespace Ocelot.Library.Infrastructure.Middleware if (IsAuthenticatedRoute(downstreamRoute.Data.ReRoute)) { - var authenticationNext = _authProviderFactory.Get(downstreamRoute.Data.ReRoute.AuthenticationProvider, _app); + var authenticationNext = _authHandlerFactory.Get(downstreamRoute.Data.ReRoute.AuthenticationProvider, _app); if (!authenticationNext.IsError) { diff --git a/src/Ocelot/Startup.cs b/src/Ocelot/Startup.cs index 35934de3..fc8a9d0f 100644 --- a/src/Ocelot/Startup.cs +++ b/src/Ocelot/Startup.cs @@ -57,7 +57,7 @@ namespace Ocelot services.AddSingleton(); services.AddSingleton(); services.AddSingleton(); - services.AddSingleton(); + services.AddSingleton(); services.AddSingleton(); // see this for why we register this as singleton http://stackoverflow.com/questions/37371264/invalidoperationexception-unable-to-resolve-service-for-type-microsoft-aspnetc diff --git a/test/Ocelot.UnitTests/Authentication/AuthenticationProviderFactoryTests.cs b/test/Ocelot.UnitTests/Authentication/AuthenticationHandlerFactoryTests.cs similarity index 85% rename from test/Ocelot.UnitTests/Authentication/AuthenticationProviderFactoryTests.cs rename to test/Ocelot.UnitTests/Authentication/AuthenticationHandlerFactoryTests.cs index 752aca0b..028d07d9 100644 --- a/test/Ocelot.UnitTests/Authentication/AuthenticationProviderFactoryTests.cs +++ b/test/Ocelot.UnitTests/Authentication/AuthenticationHandlerFactoryTests.cs @@ -12,24 +12,24 @@ using Xunit; namespace Ocelot.UnitTests.Authentication { - public class AuthenticationProviderFactoryTests + public class AuthenticationHandlerFactoryTests { - private readonly IAuthenticationProviderFactory _authenticationProviderFactory; + private readonly IAuthenticationHandlerFactory _authenticationHandlerFactory; private readonly Mock _app; private readonly Mock _creator; private string _provider; private Response _result; - public AuthenticationProviderFactoryTests() + public AuthenticationHandlerFactoryTests() { _app = new Mock(); _creator = new Mock(); - _authenticationProviderFactory = new AuthenticationProviderFactory(_creator.Object); + _authenticationHandlerFactory = new AuthenticationHandlerFactory(_creator.Object); } [Fact] - public void should_return_identity_server_access_token_provider() + public void should_return_identity_server_access_token_handler() { this.Given(x => x.GivenTheProviderIs("IdentityServer.AccessToken")) .And(x => x.GivenTheCreatorReturns()) @@ -72,7 +72,7 @@ namespace Ocelot.UnitTests.Authentication private void WhenIGetFromTheFactory() { - _result = _authenticationProviderFactory.Get(_provider, _app.Object); + _result = _authenticationHandlerFactory.Get(_provider, _app.Object); } private void ThenTheHandlerIsReturned(string expected) diff --git a/test/Ocelot.UnitTests/Middleware/AuthenticationMiddlewareTests.cs b/test/Ocelot.UnitTests/Middleware/AuthenticationMiddlewareTests.cs index 6c82b0fe..793bd66a 100644 --- a/test/Ocelot.UnitTests/Middleware/AuthenticationMiddlewareTests.cs +++ b/test/Ocelot.UnitTests/Middleware/AuthenticationMiddlewareTests.cs @@ -22,7 +22,7 @@ namespace Ocelot.UnitTests.Middleware public class AuthenticationMiddlewareTests : IDisposable { private readonly Mock _scopedRepository; - private readonly Mock _authFactory; + private readonly Mock _authFactory; private readonly string _url; private readonly TestServer _server; private readonly HttpClient _client; @@ -33,7 +33,7 @@ namespace Ocelot.UnitTests.Middleware { _url = "http://localhost:51879"; _scopedRepository = new Mock(); - _authFactory = new Mock(); + _authFactory = new Mock(); var builder = new WebHostBuilder() .ConfigureServices(x => {