From f7fe7c0f497d71e69f22989ca19e5cdfe9ecb2ad Mon Sep 17 00:00:00 2001 From: Tom Gardham-Pallister Date: Wed, 8 Feb 2017 18:47:35 +0000 Subject: [PATCH] more refactoring --- build.cake | 2 +- src/.DS_Store | Bin 0 -> 6148 bytes src/Ocelot/.DS_Store | Bin 0 -> 8196 bytes src/Ocelot/Authentication/Handler/.DS_Store | Bin 0 -> 6148 bytes .../Creator/AuthenticationHandlerCreator.cs | 2 +- .../Creator/IAuthenticationHandlerCreator.cs | 2 +- .../Factory/AuthenticationHandlerFactory.cs | 2 +- src/Ocelot/Authorisation/ClaimsAuthoriser.cs | 1 - .../Creator/FileOcelotConfigurationCreator.cs | 4 ---- .../AuthenticationHandlerFactoryTests.cs | 4 ++-- .../ErrorsToHttpStatusCodeMapperTests.cs | 3 --- 11 files changed, 6 insertions(+), 14 deletions(-) create mode 100644 src/.DS_Store create mode 100644 src/Ocelot/.DS_Store create mode 100644 src/Ocelot/Authentication/Handler/.DS_Store diff --git a/build.cake b/build.cake index 1a1f005d..0f031972 100644 --- a/build.cake +++ b/build.cake @@ -42,7 +42,7 @@ var nugetFeedStableSymbolsUploadUrl = "https://www.nuget.org/api/v2/package"; // internal build variables - don't change these. var releaseTag = ""; -var committedVersion = "0.0.0-dev"; +string committedVersion = "0.0.0-dev"; var buildVersion = committedVersion; var target = Argument("target", "Default"); diff --git a/src/.DS_Store b/src/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..e6c4e75f3d6ddeee04f8f8aa9d10d754c345d1f2 GIT binary patch literal 6148 zcmeHK&1%~~5Z-m%M2ce2A)%!-pnG$0+q9uK;Ut$(h(W;pV;+D&>Nex}K?Ve#%8I#~nEod3FA4;eNQ)E!hZCyQyG3Uh#|Yr#sPPZx8I4fT$p^hDy+8YYhqk})v;e^HpUF#Td49qjIVje@>{}2Cs|DR8CPmTe{z<w=R4f?zIu<3s4k{s}0_yfT6cyh{dh=4yYFJM`!@X7Hfmx0dWTbO@nJ3 I1Amo)pQC1So&W#< literal 0 HcmV?d00001 diff --git a/src/Ocelot/.DS_Store b/src/Ocelot/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..996c69e40ae6edfe8644ddf224acf46e45ffdbc9 GIT binary patch literal 8196 zcmeHM-EJF26h0HDu^ro$5viyUNPAg{stQmj+!;4P1Qj*ZZHh!u*tNIGmSs2WuH!~g zBwrw2fE(U{2jBrfP$V7zam$Z*i}0N@n`mb3v^SNgU?$o*oAvjdIp;fPcQXzVss4EM zD$zwEYT#hoZDE=-_;WsH#zJ|;gH_-Yg_KZ15e>;C#Za1#&pn32_DVa|R?|soI;nDHRqjxftPY+ha8f;O-Ru-_3d}0t;nI0}hsM~q z?^^qJ-p8kuY{cm>h|>T#zO~-PaS4YyKF0h6ZZOIBG*`VC?8Q-Dtgim17HW& za;x2Gb-L|Vr}fETH=PU$zZmCzKilrUG>ArF;AeNEQL%eFOxELYKTK|BH~b>ZK4$Rk zG>rk!=YFsig_G^>%JnoU{3r=C@uz*W|Nh6Hq7$j|!9^?j_tW{WC#kqU$dWisc7S6aozrTil%YmB zzH6CZt6zY=bSwjBL^TS4uT)gss-Vu%b$A?dH`ujTzgCb-K*qpE^f~1=R{G={W9<&G z=q9=k^bWc$du-Gu^LbiBU+zh7j$|Iv0d2t71N=6epSxsbdbt2EDNVr2!N|b$5%n!x zAv%XOuJ9!Ozm53Y zCpg5zJ#_`$m4jEgTO<>c_uLGRS02)5XL(SZm+4`dHYGyt@C++Qu$8+>vNSnu`Vf7~ z_yZb%!_NVzUgdF?3m+L-*3t1HeIZ=j2ey`+n}u%LXkO1|DCF{3#s-Zl4Ag55BZrFo zbeMDhNe+*U9CTDCjC@ut$-`uHp%H7f50$u=*I;v;rMMy*R$}C=On#H@NL^y^&a98c zSfVYtd$>lGT5>+Mw~T!1=zspI+*DhkV3O@PtZc_&PybZ6SmF^1?h`UPvR z@CJN2#*&gw?f&m3jqU3X@yaZWwDyJmZM46>BeH>`_5G z>;0)tuv=vm3u2FXow~dhill|ACsr zgcg168So5@Gq7yC6*>P8zrO#EPx3v_fM?)eF= k3M+RUYeSCW4HgxS1=1jf4s(mtQ2ZYOrNLL8fgfey1AVE?-~a#s literal 0 HcmV?d00001 diff --git a/src/Ocelot/Authentication/Handler/Creator/AuthenticationHandlerCreator.cs b/src/Ocelot/Authentication/Handler/Creator/AuthenticationHandlerCreator.cs index 65260d64..67f2ebbd 100644 --- a/src/Ocelot/Authentication/Handler/Creator/AuthenticationHandlerCreator.cs +++ b/src/Ocelot/Authentication/Handler/Creator/AuthenticationHandlerCreator.cs @@ -12,7 +12,7 @@ namespace Ocelot.Authentication.Handler.Creator /// public class AuthenticationHandlerCreator : IAuthenticationHandlerCreator { - public Response CreateIdentityServerAuthenticationHandler(IApplicationBuilder app, AuthenticationOptions authOptions) + public Response Create(IApplicationBuilder app, AuthenticationOptions authOptions) { var builder = app.New(); diff --git a/src/Ocelot/Authentication/Handler/Creator/IAuthenticationHandlerCreator.cs b/src/Ocelot/Authentication/Handler/Creator/IAuthenticationHandlerCreator.cs index 6baa0385..9d92c81d 100644 --- a/src/Ocelot/Authentication/Handler/Creator/IAuthenticationHandlerCreator.cs +++ b/src/Ocelot/Authentication/Handler/Creator/IAuthenticationHandlerCreator.cs @@ -8,6 +8,6 @@ namespace Ocelot.Authentication.Handler.Creator public interface IAuthenticationHandlerCreator { - Response CreateIdentityServerAuthenticationHandler(IApplicationBuilder app, AuthenticationOptions authOptions); + Response Create(IApplicationBuilder app, AuthenticationOptions authOptions); } } diff --git a/src/Ocelot/Authentication/Handler/Factory/AuthenticationHandlerFactory.cs b/src/Ocelot/Authentication/Handler/Factory/AuthenticationHandlerFactory.cs index 6379cc1f..60253816 100644 --- a/src/Ocelot/Authentication/Handler/Factory/AuthenticationHandlerFactory.cs +++ b/src/Ocelot/Authentication/Handler/Factory/AuthenticationHandlerFactory.cs @@ -19,7 +19,7 @@ namespace Ocelot.Authentication.Handler.Factory public Response Get(IApplicationBuilder app, AuthenticationOptions authOptions) { - var handler = _creator.CreateIdentityServerAuthenticationHandler(app, authOptions); + var handler = _creator.Create(app, authOptions); if (!handler.IsError) { diff --git a/src/Ocelot/Authorisation/ClaimsAuthoriser.cs b/src/Ocelot/Authorisation/ClaimsAuthoriser.cs index cb7849e9..96f7acd6 100644 --- a/src/Ocelot/Authorisation/ClaimsAuthoriser.cs +++ b/src/Ocelot/Authorisation/ClaimsAuthoriser.cs @@ -1,5 +1,4 @@ using System.Collections.Generic; -using System.Linq; using System.Security.Claims; using Ocelot.Errors; using Ocelot.Responses; diff --git a/src/Ocelot/Configuration/Creator/FileOcelotConfigurationCreator.cs b/src/Ocelot/Configuration/Creator/FileOcelotConfigurationCreator.cs index 305dfc66..357d6296 100644 --- a/src/Ocelot/Configuration/Creator/FileOcelotConfigurationCreator.cs +++ b/src/Ocelot/Configuration/Creator/FileOcelotConfigurationCreator.cs @@ -55,10 +55,6 @@ namespace Ocelot.Configuration.Creator return new OkResponse(config); } - /// - /// 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 - /// private async Task SetUpConfiguration() { var response = _configurationValidator.IsValid(_options.Value); diff --git a/test/Ocelot.UnitTests/Authentication/AuthenticationHandlerFactoryTests.cs b/test/Ocelot.UnitTests/Authentication/AuthenticationHandlerFactoryTests.cs index 229da4a9..8bf53607 100644 --- a/test/Ocelot.UnitTests/Authentication/AuthenticationHandlerFactoryTests.cs +++ b/test/Ocelot.UnitTests/Authentication/AuthenticationHandlerFactoryTests.cs @@ -66,7 +66,7 @@ namespace Ocelot.UnitTests.Authentication private void GivenTheCreatorReturnsAnError() { _creator - .Setup(x => x.CreateIdentityServerAuthenticationHandler(It.IsAny(), It.IsAny())) + .Setup(x => x.Create(It.IsAny(), It.IsAny())) .Returns(new ErrorResponse(new List { new UnableToCreateAuthenticationHandlerError($"Unable to create authentication handler for xxx") @@ -76,7 +76,7 @@ namespace Ocelot.UnitTests.Authentication private void GivenTheCreatorReturns() { _creator - .Setup(x => x.CreateIdentityServerAuthenticationHandler(It.IsAny(), It.IsAny())) + .Setup(x => x.Create(It.IsAny(), It.IsAny())) .Returns(new OkResponse(x => Task.CompletedTask)); } diff --git a/test/Ocelot.UnitTests/Responder/ErrorsToHttpStatusCodeMapperTests.cs b/test/Ocelot.UnitTests/Responder/ErrorsToHttpStatusCodeMapperTests.cs index 78f78235..cb8198dc 100644 --- a/test/Ocelot.UnitTests/Responder/ErrorsToHttpStatusCodeMapperTests.cs +++ b/test/Ocelot.UnitTests/Responder/ErrorsToHttpStatusCodeMapperTests.cs @@ -1,7 +1,4 @@ using System.Collections.Generic; -using System.IO; -using System.Net.Http; -using Microsoft.AspNetCore.Http; using Ocelot.Errors; using Ocelot.Middleware; using Ocelot.Responder;