mirror of
				https://github.com/nsnail/Ocelot.git
				synced 2025-11-04 15:50:49 +08:00 
			
		
		
		
	more refactoring
This commit is contained in:
		@@ -42,7 +42,7 @@ var nugetFeedStableSymbolsUploadUrl = "https://www.nuget.org/api/v2/package";
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
// internal build variables - don't change these.
 | 
					// internal build variables - don't change these.
 | 
				
			||||||
var releaseTag = "";
 | 
					var releaseTag = "";
 | 
				
			||||||
var committedVersion = "0.0.0-dev";
 | 
					string committedVersion = "0.0.0-dev";
 | 
				
			||||||
var buildVersion = committedVersion;
 | 
					var buildVersion = committedVersion;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
var target = Argument("target", "Default");
 | 
					var target = Argument("target", "Default");
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										
											BIN
										
									
								
								src/.DS_Store
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								src/.DS_Store
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								src/Ocelot/.DS_Store
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								src/Ocelot/.DS_Store
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								src/Ocelot/Authentication/Handler/.DS_Store
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								src/Ocelot/Authentication/Handler/.DS_Store
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							@@ -12,7 +12,7 @@ namespace Ocelot.Authentication.Handler.Creator
 | 
				
			|||||||
    /// </summary>
 | 
					    /// </summary>
 | 
				
			||||||
    public class AuthenticationHandlerCreator : IAuthenticationHandlerCreator
 | 
					    public class AuthenticationHandlerCreator : IAuthenticationHandlerCreator
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        public Response<RequestDelegate> CreateIdentityServerAuthenticationHandler(IApplicationBuilder app, AuthenticationOptions authOptions)
 | 
					        public Response<RequestDelegate> Create(IApplicationBuilder app, AuthenticationOptions authOptions)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            var builder = app.New();
 | 
					            var builder = app.New();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -8,6 +8,6 @@ namespace Ocelot.Authentication.Handler.Creator
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    public interface IAuthenticationHandlerCreator
 | 
					    public interface IAuthenticationHandlerCreator
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        Response<RequestDelegate> CreateIdentityServerAuthenticationHandler(IApplicationBuilder app, AuthenticationOptions authOptions);
 | 
					        Response<RequestDelegate> Create(IApplicationBuilder app, AuthenticationOptions authOptions);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -19,7 +19,7 @@ namespace Ocelot.Authentication.Handler.Factory
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        public Response<AuthenticationHandler> Get(IApplicationBuilder app, AuthenticationOptions authOptions)
 | 
					        public Response<AuthenticationHandler> Get(IApplicationBuilder app, AuthenticationOptions authOptions)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            var handler = _creator.CreateIdentityServerAuthenticationHandler(app, authOptions);
 | 
					            var handler = _creator.Create(app, authOptions);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if (!handler.IsError)
 | 
					            if (!handler.IsError)
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,5 +1,4 @@
 | 
				
			|||||||
using System.Collections.Generic;
 | 
					using System.Collections.Generic;
 | 
				
			||||||
using System.Linq;
 | 
					 | 
				
			||||||
using System.Security.Claims;
 | 
					using System.Security.Claims;
 | 
				
			||||||
using Ocelot.Errors;
 | 
					using Ocelot.Errors;
 | 
				
			||||||
using Ocelot.Responses;
 | 
					using Ocelot.Responses;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -55,10 +55,6 @@ namespace Ocelot.Configuration.Creator
 | 
				
			|||||||
            return new OkResponse<IOcelotConfiguration>(config);
 | 
					            return new OkResponse<IOcelotConfiguration>(config);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        /// <summary>
 | 
					 | 
				
			||||||
        /// This method is meant to be tempoary to convert a config to an ocelot config...probably wont keep this but we will see
 | 
					 | 
				
			||||||
        /// will need a refactor at some point as its crap
 | 
					 | 
				
			||||||
        /// </summary>
 | 
					 | 
				
			||||||
        private async Task<IOcelotConfiguration> SetUpConfiguration()
 | 
					        private async Task<IOcelotConfiguration> SetUpConfiguration()
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            var response = _configurationValidator.IsValid(_options.Value);
 | 
					            var response = _configurationValidator.IsValid(_options.Value);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -66,7 +66,7 @@ namespace Ocelot.UnitTests.Authentication
 | 
				
			|||||||
        private void GivenTheCreatorReturnsAnError()
 | 
					        private void GivenTheCreatorReturnsAnError()
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            _creator
 | 
					            _creator
 | 
				
			||||||
                .Setup(x => x.CreateIdentityServerAuthenticationHandler(It.IsAny<IApplicationBuilder>(), It.IsAny<AuthenticationOptions>()))
 | 
					                .Setup(x => x.Create(It.IsAny<IApplicationBuilder>(), It.IsAny<AuthenticationOptions>()))
 | 
				
			||||||
                .Returns(new ErrorResponse<RequestDelegate>(new List<Error>
 | 
					                .Returns(new ErrorResponse<RequestDelegate>(new List<Error>
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                new UnableToCreateAuthenticationHandlerError($"Unable to create authentication handler for xxx")
 | 
					                new UnableToCreateAuthenticationHandlerError($"Unable to create authentication handler for xxx")
 | 
				
			||||||
@@ -76,7 +76,7 @@ namespace Ocelot.UnitTests.Authentication
 | 
				
			|||||||
        private void GivenTheCreatorReturns()
 | 
					        private void GivenTheCreatorReturns()
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            _creator
 | 
					            _creator
 | 
				
			||||||
                .Setup(x => x.CreateIdentityServerAuthenticationHandler(It.IsAny<IApplicationBuilder>(), It.IsAny<AuthenticationOptions>()))
 | 
					                .Setup(x => x.Create(It.IsAny<IApplicationBuilder>(), It.IsAny<AuthenticationOptions>()))
 | 
				
			||||||
                .Returns(new OkResponse<RequestDelegate>(x => Task.CompletedTask));
 | 
					                .Returns(new OkResponse<RequestDelegate>(x => Task.CompletedTask));
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,7 +1,4 @@
 | 
				
			|||||||
using System.Collections.Generic;
 | 
					using System.Collections.Generic;
 | 
				
			||||||
using System.IO;
 | 
					 | 
				
			||||||
using System.Net.Http;
 | 
					 | 
				
			||||||
using Microsoft.AspNetCore.Http;
 | 
					 | 
				
			||||||
using Ocelot.Errors;
 | 
					using Ocelot.Errors;
 | 
				
			||||||
using Ocelot.Middleware;
 | 
					using Ocelot.Middleware;
 | 
				
			||||||
using Ocelot.Responder;
 | 
					using Ocelot.Responder;
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user