renamed provider to handler

This commit is contained in:
TomPallister
2016-10-16 16:47:08 +01:00
parent 320b442526
commit 7289cd803b
6 changed files with 16 additions and 16 deletions

View File

@ -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;
}

View File

@ -3,7 +3,7 @@ using Ocelot.Library.Infrastructure.Responses;
namespace Ocelot.Library.Infrastructure.Authentication
{
public interface IAuthenticationProviderFactory
public interface IAuthenticationHandlerFactory
{
Response<AuthenticationHandler> Get(string provider, IApplicationBuilder app);
}

View File

@ -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)
{

View File

@ -57,7 +57,7 @@ namespace Ocelot
services.AddSingleton<IHttpResponder, HttpContextResponder>();
services.AddSingleton<IRequestBuilder, HttpRequestBuilder>();
services.AddSingleton<IErrorsToHttpStatusCodeMapper, ErrorsToHttpStatusCodeMapper>();
services.AddSingleton<IAuthenticationProviderFactory, AuthenticationProviderFactory>();
services.AddSingleton<IAuthenticationHandlerFactory, AuthenticationHandlerFactory>();
services.AddSingleton<IAuthenticationHandlerCreator, AuthenticationHandlerCreator>();
// see this for why we register this as singleton http://stackoverflow.com/questions/37371264/invalidoperationexception-unable-to-resolve-service-for-type-microsoft-aspnetc