diff --git a/src/Ocelot/Authentication/JsonConverters/AuthenticationConfigConverter.cs b/src/Ocelot/Authentication/JsonConverters/AuthenticationConfigConverter.cs deleted file mode 100644 index 1c94e9d3..00000000 --- a/src/Ocelot/Authentication/JsonConverters/AuthenticationConfigConverter.cs +++ /dev/null @@ -1,61 +0,0 @@ -/* -using System; -using Newtonsoft.Json; -using Newtonsoft.Json.Linq; -using Ocelot.Configuration; - -namespace Ocelot.Authentication.JsonConverters -{ - public class AuthenticationConfigConverter : JsonConverter - { - public override bool CanWrite => false; - - public override bool CanRead => true; - - public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) - { - throw new InvalidOperationException("Use default serialization."); - } - - public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) - { - var jsonObject = JObject.Load(reader); - var setting = default(IAuthenticationConfig); - - if (jsonObject["Provider"] != null) - { - switch (jsonObject["Provider"].Value()) - { - case "Jwt": - setting = new JwtConfig( - jsonObject["Authority"].Value(), - jsonObject["Audience"].Value()); - break; - - default: - setting = new IdentityServerConfig( - jsonObject["ProviderRootUrl"].Value(), - jsonObject["ApiName"].Value(), - jsonObject["RequireHttps"].Value(), - jsonObject["ApiSecret"].Value()); - break; - } - } - else - { - setting = new IdentityServerConfig(string.Empty, string.Empty, false, string.Empty); - } - - serializer.Populate(jsonObject.CreateReader(), setting); - return setting; - } - - public override bool CanConvert(Type objectType) - { - return objectType == typeof(IAuthenticationConfig); - } - } - - -} -*/ diff --git a/src/Ocelot/Configuration/Creator/AuthenticationProviderConfigCreator.cs b/src/Ocelot/Configuration/Creator/AuthenticationProviderConfigCreator.cs deleted file mode 100644 index a9bb2cc6..00000000 --- a/src/Ocelot/Configuration/Creator/AuthenticationProviderConfigCreator.cs +++ /dev/null @@ -1,37 +0,0 @@ -/*using Ocelot.Creator.Configuration; - -namespace Ocelot.Configuration.Creator -{ - using Ocelot.Configuration.Builder; - using Ocelot.Configuration.File; - - public class AuthenticationProviderConfigCreator : IAuthenticationProviderConfigCreator - { - public IAuthenticationConfig Create(FileAuthenticationOptions authenticationOptions) - { - if (authenticationOptions.Provider?.ToLower() == "jwt") - { - return CreateJwt(authenticationOptions); - } - - return CreateIdentityServer(authenticationOptions); - } - - private JwtConfig CreateJwt(FileAuthenticationOptions authenticationOptions) - { - return new JwtConfigBuilder() - .WithAudience(authenticationOptions.JwtConfig?.Audience) - .WithAuthority(authenticationOptions.JwtConfig?.Authority) - .Build(); - } - - private IdentityServerConfig CreateIdentityServer(FileAuthenticationOptions authenticationOptions) - { - return new IdentityServerConfigBuilder() - .WithApiName(authenticationOptions.IdentityServerConfig?.ApiName) - .WithApiSecret(authenticationOptions.IdentityServerConfig?.ApiSecret) - .WithProviderRootUrl(authenticationOptions.IdentityServerConfig?.ProviderRootUrl) - .WithRequireHttps(authenticationOptions.IdentityServerConfig.RequireHttps).Build(); - } - } -}*/ \ No newline at end of file diff --git a/src/Ocelot/Creator/Configuration/IAuthenticationProviderConfigCreator.cs b/src/Ocelot/Creator/Configuration/IAuthenticationProviderConfigCreator.cs deleted file mode 100644 index 354af4c5..00000000 --- a/src/Ocelot/Creator/Configuration/IAuthenticationProviderConfigCreator.cs +++ /dev/null @@ -1,10 +0,0 @@ -/*using Ocelot.Configuration; -using Ocelot.Configuration.File; - -namespace Ocelot.Creator.Configuration -{ - public interface IAuthenticationProviderConfigCreator - { - IAuthenticationConfig Create(FileAuthenticationOptions authenticationOptions); - } -}*/ \ No newline at end of file diff --git a/src/Ocelot/Errors/Middleware/ExceptionHandlerMiddleware.cs b/src/Ocelot/Errors/Middleware/ExceptionHandlerMiddleware.cs index 2514199f..5a6139ba 100644 --- a/src/Ocelot/Errors/Middleware/ExceptionHandlerMiddleware.cs +++ b/src/Ocelot/Errors/Middleware/ExceptionHandlerMiddleware.cs @@ -51,11 +51,6 @@ namespace Ocelot.Errors.Middleware private void SetInternalServerErrorOnResponse(HttpContext context) { context.Response.StatusCode = 500; - /* context.Response.OnStarting(x => - { - context.Response.StatusCode = 500; - return Task.CompletedTask; - }, context);*/ } private string CreateMessage(HttpContext context, Exception e) diff --git a/test/Ocelot.AcceptanceTests/AuthorisationTests.cs b/test/Ocelot.AcceptanceTests/AuthorisationTests.cs index 14a61f02..a8901573 100644 --- a/test/Ocelot.AcceptanceTests/AuthorisationTests.cs +++ b/test/Ocelot.AcceptanceTests/AuthorisationTests.cs @@ -44,21 +44,6 @@ namespace Ocelot.AcceptanceTests { var configuration = new FileConfiguration { -/* AuthenticationOptions = new List - { - new FileAuthenticationOptions - { - AllowedScopes = new List(), - Provider = "IdentityServer", - IdentityServerConfig = new FileIdentityServerConfig{ - ProviderRootUrl = "http://localhost:51888", - RequireHttps = false, - ApiName = "api", - ApiSecret = "secret" - }, - AuthenticationProviderKey = "Test" - } - },*/ ReRoutes = new List { new FileReRoute @@ -111,21 +96,6 @@ namespace Ocelot.AcceptanceTests { var configuration = new FileConfiguration { -/* AuthenticationOptions = new List - { - new FileAuthenticationOptions - { - AllowedScopes = new List(), - Provider = "IdentityServer", - IdentityServerConfig = new FileIdentityServerConfig{ - ProviderRootUrl = "http://localhost:51888", - RequireHttps = false, - ApiName = "api", - ApiSecret = "secret" - }, - AuthenticationProviderKey = "Test" - } - },*/ ReRoutes = new List { new FileReRoute @@ -176,21 +146,6 @@ namespace Ocelot.AcceptanceTests { var configuration = new FileConfiguration { - /* AuthenticationOptions = new List - { - new FileAuthenticationOptions - { - AllowedScopes = new List{ "api", "api.readOnly", "openid", "offline_access" }, - Provider = "IdentityServer", - IdentityServerConfig = new FileIdentityServerConfig{ - ProviderRootUrl = "http://localhost:51888", - RequireHttps = false, - ApiName = "api", - ApiSecret = "secret" - }, - AuthenticationProviderKey = "Test" - } - },*/ ReRoutes = new List { new FileReRoute @@ -226,21 +181,6 @@ namespace Ocelot.AcceptanceTests { var configuration = new FileConfiguration { - /* AuthenticationOptions = new List - { - new FileAuthenticationOptions - { - AllowedScopes = new List{ "api", "openid", "offline_access" }, - Provider = "IdentityServer", - IdentityServerConfig = new FileIdentityServerConfig{ - ProviderRootUrl = "http://localhost:51888", - RequireHttps = false, - ApiName = "api", - ApiSecret = "secret" - }, - AuthenticationProviderKey = "Test" - } - },*/ ReRoutes = new List { new FileReRoute diff --git a/test/Ocelot.AcceptanceTests/ClaimsToHeadersForwardingTests.cs b/test/Ocelot.AcceptanceTests/ClaimsToHeadersForwardingTests.cs index 8ab0c0ba..abfb002a 100644 --- a/test/Ocelot.AcceptanceTests/ClaimsToHeadersForwardingTests.cs +++ b/test/Ocelot.AcceptanceTests/ClaimsToHeadersForwardingTests.cs @@ -58,24 +58,6 @@ namespace Ocelot.AcceptanceTests var configuration = new FileConfiguration { - /* AuthenticationOptions = new List - { - new FileAuthenticationOptions - { - AllowedScopes = new List - { - "openid", "offline_access", "api" - }, - Provider = "IdentityServer", - IdentityServerConfig = new FileIdentityServerConfig{ - ProviderRootUrl = "http://localhost:52888", - RequireHttps = false, - ApiName = "api", - ApiSecret = "secret" - }, - AuthenticationProviderKey = "Test" - } - },*/ ReRoutes = new List { new FileReRoute diff --git a/test/Ocelot.AcceptanceTests/ClaimsToQueryStringForwardingTests.cs b/test/Ocelot.AcceptanceTests/ClaimsToQueryStringForwardingTests.cs index cbc55638..d7d1b39c 100644 --- a/test/Ocelot.AcceptanceTests/ClaimsToQueryStringForwardingTests.cs +++ b/test/Ocelot.AcceptanceTests/ClaimsToQueryStringForwardingTests.cs @@ -58,24 +58,6 @@ namespace Ocelot.AcceptanceTests var configuration = new FileConfiguration { - /* AuthenticationOptions = new List - { - new FileAuthenticationOptions - { - AllowedScopes = new List - { - "openid", "offline_access", "api" - }, - Provider = "IdentityServer", - IdentityServerConfig = new FileIdentityServerConfig{ - ProviderRootUrl = "http://localhost:57888", - RequireHttps = false, - ApiName = "api", - ApiSecret = "secret" - }, - AuthenticationProviderKey = "Test" - } - },*/ ReRoutes = new List { new FileReRoute