diff --git a/source/Core/Configuration/AppBuilderExtensions/ConfigureHttpLoggingExtension.cs b/source/Core/Configuration/AppBuilderExtensions/ConfigureHttpLoggingExtension.cs deleted file mode 100644 index 351fd959a..000000000 --- a/source/Core/Configuration/AppBuilderExtensions/ConfigureHttpLoggingExtension.cs +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright 2014, 2015 Dominick Baier, Brock Allen - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -using IdentityServer3.Core.Configuration; -using IdentityServer3.Core.Extensions; -using IdentityServer3.Core.Logging; -using Microsoft.Owin; -using System; -using System.IO; -using System.Threading.Tasks; - -namespace Owin -{ - static class ConfigureHttpLoggingExtension - { - static readonly ILog Logger = LogProvider.GetLogger("HTTP Logging"); - - public static IAppBuilder ConfigureHttpLogging(this IAppBuilder app, LoggingOptions options) - { - if (options.EnableHttpLogging) - { - app.Use(async (ctx, next) => - { - await LogRequest(ctx.Request); - - var oldStream = ctx.Response.Body; - var ms = ctx.Response.Body = new MemoryStream(); - - try - { - await next(); - await LogResponse(ctx.Response); - - ctx.Response.Body = oldStream; - await ms.CopyToAsync(oldStream); - } - catch(Exception ex) - { - Logger.DebugException("HTTP Response Exception", ex); - throw; - } - }); - } - - return app; - } - - private static async Task LogRequest(IOwinRequest request) - { - var reqLog = new - { - Method = request.Method, - Url = request.Uri.AbsoluteUri, - Headers = request.Headers, - Body = await request.ReadBodyAsStringAsync() - }; - - Logger.Debug("HTTP Request" + Environment.NewLine + LogSerializer.Serialize(reqLog)); - } - - private static async Task LogResponse(IOwinResponse response) - { - var respLog = new - { - StatusCode = response.StatusCode, - Headers = response.Headers, - Body = await response.ReadBodyAsStringAsync() - }; - - Logger.Debug("HTTP Response" + Environment.NewLine + LogSerializer.Serialize(respLog)); - } - } -} diff --git a/source/Core/Configuration/AppBuilderExtensions/UseIdentityServerExtension.cs b/source/Core/Configuration/AppBuilderExtensions/UseIdentityServerExtension.cs index 9a48b9e46..9a492c125 100644 --- a/source/Core/Configuration/AppBuilderExtensions/UseIdentityServerExtension.cs +++ b/source/Core/Configuration/AppBuilderExtensions/UseIdentityServerExtension.cs @@ -102,10 +102,8 @@ public static IAppBuilder UseIdentityServer(this IAppBuilder app, IdentityServer options.AuthenticationOptions.IdentityProviders(app, Constants.ExternalAuthenticationType); } - app.ConfigureHttpLogging(options.LoggingOptions); - SignatureConversions.AddConversions(app); - + var httpConfig = WebApiConfig.Configure(options, container); app.UseAutofacWebApi(httpConfig); app.UseWebApi(httpConfig); @@ -116,14 +114,14 @@ public static IAppBuilder UseIdentityServer(this IAppBuilder app, IdentityServer // TODO -- perhaps use AsyncHelper instead? DoStartupDiagnosticsAsync(options, eventSvc).Wait(); } - + return app; } private static async Task DoStartupDiagnosticsAsync(IdentityServerOptions options, IEventService eventSvc) { var cert = options.SigningCertificate; - + if (cert == null) { Logger.Warn("No signing certificate configured."); diff --git a/source/Core/Configuration/LoggingOptions.cs b/source/Core/Configuration/LoggingOptions.cs index 976c90f5f..89a68badc 100644 --- a/source/Core/Configuration/LoggingOptions.cs +++ b/source/Core/Configuration/LoggingOptions.cs @@ -28,7 +28,6 @@ public LoggingOptions() { EnableWebApiDiagnostics = false; WebApiDiagnosticsIsVerbose = false; - EnableHttpLogging = false; EnableKatanaLogging = false; } @@ -48,14 +47,6 @@ public LoggingOptions() /// public bool WebApiDiagnosticsIsVerbose { get; set; } - /// - /// Gets or sets a value indicating whether HTTP request/response logging is enabled - /// - /// - /// true if HTTP logging is enabled; otherwise, false. - /// - public bool EnableHttpLogging { get; set; } - /// /// Gets or sets a value indicating whether Katana logging should be forwarded to the standard logging output. /// diff --git a/source/Core/Core.csproj b/source/Core/Core.csproj index e20f24881..b7a4b3be4 100644 --- a/source/Core/Core.csproj +++ b/source/Core/Core.csproj @@ -133,7 +133,6 @@ -